1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(datetime_date_fromtimestamp__doc__,
6 "fromtimestamp($type, timestamp, /)\n"
7 "--\n"
8 "\n"
9 "Create a date from a POSIX timestamp.\n"
10 "\n"
11 "The timestamp is a number, e.g. created via time.time(), that is interpreted\n"
12 "as local time.");
13 
14 #define DATETIME_DATE_FROMTIMESTAMP_METHODDEF    \
15     {"fromtimestamp", (PyCFunction)datetime_date_fromtimestamp, METH_O|METH_CLASS, datetime_date_fromtimestamp__doc__},
16 
17 PyDoc_STRVAR(datetime_datetime_now__doc__,
18 "now($type, /, tz=None)\n"
19 "--\n"
20 "\n"
21 "Returns new datetime object representing current time local to tz.\n"
22 "\n"
23 "  tz\n"
24 "    Timezone object.\n"
25 "\n"
26 "If no tz is specified, uses local timezone.");
27 
28 #define DATETIME_DATETIME_NOW_METHODDEF    \
29     {"now", (PyCFunction)(void(*)(void))datetime_datetime_now, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
30 
31 static PyObject *
32 datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
33 
34 static PyObject *
datetime_datetime_now(PyTypeObject * type,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)35 datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
36 {
37     PyObject *return_value = NULL;
38     static const char * const _keywords[] = {"tz", NULL};
39     static _PyArg_Parser _parser = {NULL, _keywords, "now", 0};
40     PyObject *argsbuf[1];
41     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
42     PyObject *tz = Py_None;
43 
44     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
45     if (!args) {
46         goto exit;
47     }
48     if (!noptargs) {
49         goto skip_optional_pos;
50     }
51     tz = args[0];
52 skip_optional_pos:
53     return_value = datetime_datetime_now_impl(type, tz);
54 
55 exit:
56     return return_value;
57 }
58 /*[clinic end generated code: output=aae916ab728ca85b input=a9049054013a1b77]*/
59