Lines Matching refs:time

1 /*  C implementation for the date/time type documented at
21 #include <time.h>
100 /* Time accessors for time. */
473 /* Check that time arguments are in range. Return 0 if they are. If they
660 * tp_basicsize for the time and datetime types is set to the size of the
842 return -4; // Malformed time separator
879 // Parse the time portion of a datetime.isoformat() string
884 // -3: Failed to parse time component
885 // -4: Failed to parse time separator
905 // We know that there's no time zone, so if there's stuff at the
915 // Special case UTC / Zulu time.
1067 /* Create a time instance with no range checking. */
1567 /* I sure don't want to reproduce the strftime code from the time module,
1628 * the next time through the loop.*/
1721 PyObject *time = PyImport_ImportModule("time");
1723 if (time == NULL)
1727 result = _PyObject_CallMethodIdObjArgs(time, &PyId_strftime,
1731 Py_DECREF(time);
1742 * Wrap functions from the time module. These aren't directly available
1746 /* Call time.time() and return its result (a Python float). */
1751 PyObject *time = PyImport_ImportModule("time");
1753 if (time != NULL) {
1754 _Py_IDENTIFIER(time);
1756 result = _PyObject_CallMethodIdNoArgs(time, &PyId_time);
1757 Py_DECREF(time);
1762 /* Build a time.struct_time. The weekday and day number are automatically
1768 PyObject *time;
1774 time = PyImport_ImportModule("time");
1775 if (time == NULL) {
1786 Py_DECREF(time);
1790 result = _PyObject_CallMethodIdOneArg(time, &PyId_struct_time, args);
1791 Py_DECREF(time);
2967 /* Return new date from current time.
2968 * We say this is equivalent to fromtimestamp(time.time()), and the
2969 * only way to be sure of that is to *call* time.time(). That's not
2970 * generally the same as calling C's time.
2975 PyObject *time;
2979 time = time_time();
2980 if (time == NULL)
2986 * time.time() delivers; if someone were gonzo about optimization,
2987 * date.today() could get away with plain C time().
2989 result = _PyObject_CallMethodIdOneArg(cls, &PyId_fromtimestamp, time);
2990 Py_DECREF(time);
3003 The timestamp is a number, e.g. created via time.time(), that is interpreted
3004 as local time.
3578 "self.__class__.fromtimestamp(time.time()).")},
3592 PyDoc_STR("Return time tuple, compatible with time.localtime().")},
3687 * datetime and time constructors (their tzinfo arguments need to
3844 PyDoc_STR("datetime -> string name of time zone.")},
3854 PyDoc_STR("datetime in UTC -> datetime in local time.")},
3863 PyDoc_STR("Abstract base class for time zone info objects.");
4090 PyDoc_STR("datetime in UTC -> datetime in local time.")},
4275 "a time object. "
4331 * Various ways to turn a time into a string.
4643 // The spec actually requires that time-only ISO 8601 strings start with
4735 "of additional terms\nof the time to include. Valid "
4755 PyDoc_STR("Return time with new specified fields.")},
4758 PyDoc_STR("string -> time from a string in ISO 8601 format")},
4770 PyDoc_STR("time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object\n\
4777 "datetime.time", /* tp_name */
5058 * means that fold detection for time values between
5064 * for this time range.
5100 * to get that much precision (e.g., C time() isn't good enough).
5117 * Build most accurate possible datetime for current time. Pass localtime or
5142 Returns new datetime object representing current time local to tz.
5153 /* Return best possible local time -- this isn't constrained by the
5170 /* Return best possible UTC time -- this isn't constrained by the
5239 /* Return new datetime from date/datetime and time arguments. */
5243 static char *keywords[] = {"date", "time", "tzinfo", NULL};
5245 PyObject *time;
5251 &PyDateTime_TimeType, &time, &tzinfo)) {
5253 if (HASTZINFO(time))
5254 tzinfo = ((PyDateTime_Time *)time)->tzinfo;
5261 TIME_GET_HOUR(time),
5262 TIME_GET_MINUTE(time),
5263 TIME_GET_SECOND(time),
5264 TIME_GET_MICROSECOND(time),
5266 TIME_GET_FOLD(time),
5354 // since the time components all come in pairs YYYYWww#HH can be
6225 /* Conversion to self's own time zone is a NOP. */
6530 PyDoc_STR("Return a new datetime representing UTC day and time.")},
6534 PyDoc_STR("timestamp[, tz] -> tz's local time from POSIX timestamp.")},
6543 "(like time.strptime()).")},
6547 PyDoc_STR("date, time -> datetime with same date and time fields")},
6558 {"time", (PyCFunction)datetime_gettime, METH_NOARGS,
6559 PyDoc_STR("Return time object with same time but with tzinfo=None.")},
6562 PyDoc_STR("Return time object with same time and tzinfo.")},
6568 PyDoc_STR("Return time tuple, compatible with time.localtime().")},
6574 PyDoc_STR("Return UTC time tuple, compatible with time.localtime().")},
6579 "sep is used to separate the year from the time, and "
6582 "of additional terms\nof the time to include. Valid "
6599 PyDoc_STR("tz -> convert to local time in new timezone tz\n")},
6723 // of C standards. Fill tp_base at run-time rather than statically.
6774 /* time values */
6925 Some time zone algebra. For a datetime x, let
6926 x.n = x stripped of its timezone -- its naive time.
6942 3. The naive UTC time corresponding to x is x.n - x.o.
6983 less than 24 hours. For that reason, if y is firmly in std time, (y+k).d must
6991 mapping from UTC to tz's standard time.
6997 we have an equivalent time, and are almost done. The insecurity here is
6998 at the start of daylight time. Picture US Eastern for concreteness. The wall
6999 time jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good
7000 sense then. The docs ask that an Eastern tzinfo class consider such a time to
7005 In fact, if [5] holds at this point, we do have the standard-time spelling,
7029 If [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time
7034 add to z (in effect, z is in tz's standard time, and we need to shift the
7035 local clock into tz's daylight time).
7065 a dst() offset, and starting *from* a time already in DST (we know z.d != 0),
7072 that hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM
7074 time (4:MM UTC). There is no local time mapping to 5:MM UTC. The local
7076 standard time. Since that's what the local clock *does*, we want to map both
7078 in local time, but so it goes -- it's the way the local clock works.
7085 Because we know z.d said z was in daylight time (else [5] would have held and
7091 z' must be in standard time, and is the spelling we want in this case.
7094 concerned (because it takes z' as being in standard time rather than the
7095 daylight time we intend here), but returning it gives the real-life "local
7100 the 1:MM standard time spelling we want.
7106 time zone. This isn't true if, for political reasons or continental drift,
7109 2) There may be versions of "double daylight" time where the tail end of
7114 "almost all" time zones: so long as the standard offset is invariant, it
7115 doesn't matter if daylight time transition points change from year to year, or
7116 if daylight time is skipped in some years; it doesn't matter how large or
7118 perverse time zone returns a negative dst()). So a breaking case must be