Lines Matching defs:time

1 """Concrete date/time and related types.
3 See http://www.iana.org/time-zones/repository/tz-link.html for
4 time zone and DST data sources.
7 __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
11 import time as _time
372 raise ValueError("Incomplete time component")
386 raise ValueError("Invalid time separator: %c" % next_char)
416 raise ValueError("Isoformat time too short")
430 # Valid time zone strings are:
440 raise ValueError("Malformed time zone string")
959 "Construct a date from a POSIX timestamp (like time.time())."
965 "Construct a date from time.time()."
966 t = _time.time()
1018 # XXX These shouldn't depend on time.localtime(), because that
1054 - http://www.cl.cam.ac.uk/~mgk25/iso-time.html
1080 "Return local time tuple compatible with time.localtime()."
1224 """Abstract base class for time zone info classes.
1231 "datetime -> string name of time zone."
1247 "datetime in UTC -> datetime in local time."
1315 class time:
1316 """Time with time zone.
1360 "a time object. "
1411 # Comparisons of time objects with other.
1414 if isinstance(other, time):
1420 if isinstance(other, time):
1426 if isinstance(other, time):
1432 if isinstance(other, time):
1438 if isinstance(other, time):
1444 assert isinstance(other, time)
1487 self._hashcode = hash(time(h, m, self.second, self.microsecond))
1519 """Return the time formatted according to ISO.
1525 terms of the time to include. Valid options are 'auto', 'hours',
1539 """Construct a time from a string in one of the ISO 8601 formats."""
1543 # The spec actually requires that time-only ISO 8601 strings start with
1613 """Return a new time with new values for the specified fields."""
1662 _time_class = time # so functions w/ args named "time" can get at the class
1664 time.min = time(0, 0, 0)
1665 time.max = time(23, 59, 59, 999999)
1666 time.resolution = timedelta(microseconds=1)
1675 __slots__ = date.__slots__ + time.__slots__
1744 """Construct a datetime from a POSIX timestamp (like time.time()).
1768 # thus we can't perform fold detection for values of time less
1769 # than the max time fold. See comments in _datetimemodule's
1788 """Construct a datetime from a POSIX timestamp (like time.time()).
1803 "Construct a datetime from time.time() and optional time zone info."
1804 t = _time.time()
1809 "Construct a UTC datetime from time.time()."
1810 t = _time.time()
1814 def combine(cls, date, time, tzinfo=True):
1815 "Construct a datetime from a given date and a given time."
1818 if not isinstance(time, _time_class):
1819 raise TypeError("time argument must be a time instance")
1821 tzinfo = time.tzinfo
1823 time.hour, time.minute, time.second, time.microsecond,
1824 tzinfo, fold=time.fold)
1858 "Return local time tuple compatible with time.localtime()."
1914 "Return UTC time tuple compatible with time.gmtime()."
1926 def time(self):
1927 "Return the time part, with tzinfo None."
1928 return time(self.hour, self.minute, self.second, self.microsecond, fold=self.fold)
1931 "Return the time part, with same tzinfo."
1932 return time(self.hour, self.minute, self.second, self.microsecond,
1991 # Convert self to UTC, and attach the new time zone object.
1994 # Convert from UTC to tz's local time.
2010 """Return the time formatted according to ISO.
2019 time, default 'T'.
2022 terms of the time to include. Valid options are 'auto', 'hours',
2061 'string, format -> new datetime parsed from a string (like time.strptime()).'
2195 time(hour, minute, second,
2223 raise TypeError("cannot mix naive and timezone-aware time")
2422 # Some time zone algebra. For a datetime x, let
2423 # x.n = x stripped of its timezone -- its naive time.
2439 # 3. The naive UTC time corresponding to x is x.n - x.o.
2480 # less than 24 hours. For that reason, if y is firmly in std time, (y+k).d must
2488 # mapping from UTC to tz's standard time.
2494 # we have an equivalent time, and are almost done. The insecurity here is
2495 # at the start of daylight time. Picture US Eastern for concreteness. The wall
2496 # time jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good
2497 # sense then. The docs ask that an Eastern tzinfo class consider such a time to
2502 # In fact, if [5] holds at this point, we do have the standard-time spelling,
2526 # If [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time
2531 # add to z (in effect, z is in tz's standard time, and we need to shift the
2532 # local clock into tz's daylight time).
2562 # a dst() offset, and starting *from* a time already in DST (we know z.d != 0),
2569 # that hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM
2571 # time (4:MM UTC). There is no local time mapping to 5:MM UTC. The local
2573 # standard time. Since that's what the local clock *does*, we want to map both
2575 # in local time, but so it goes -- it's the way the local clock works.
2582 # Because we know z.d said z was in daylight time (else [5] would have held and
2588 # z' must be in standard time, and is the spelling we want in this case.
2591 # concerned (because it takes z' as being in standard time rather than the
2592 # daylight time we intend here), but returning it gives the real-life "local
2597 # the 1:MM standard time spelling we want.
2603 # time zone. This isn't true if, for political reasons or continental drift,
2606 # 2) There may be versions of "double daylight" time where the tail end of
2611 # "almost all" time zones: so long as the standard offset is invariant, it
2612 # doesn't matter if daylight time transition points change from year to year, or
2613 # if daylight time is skipped in some years; it doesn't matter how large or
2615 # perverse time zone returns a negative dst()). So a breaking case must be