blob: 688c903e2faf8b0209689e7c41156914eccbb004 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(datetime_datetime_now__doc__,
6"now($type, /, tz=None)\n"
7"--\n"
8"\n"
9"Returns new datetime object representing current time local to tz.\n"
10"\n"
11" tz\n"
12" Timezone object.\n"
13"\n"
14"If no tz is specified, uses local timezone.");
15
16#define DATETIME_DATETIME_NOW_METHODDEF \
17 {"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
18
19static PyObject *
20datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
21
22static PyObject *
23datetime_datetime_now(PyTypeObject *type, PyObject *args, PyObject *kwargs)
24{
25 PyObject *return_value = NULL;
26 static char *_keywords[] = {"tz", NULL};
27 PyObject *tz = Py_None;
28
Serhiy Storchaka247789c2015-04-24 00:40:51 +030029 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:now", _keywords,
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030030 &tz))
31 goto exit;
32 return_value = datetime_datetime_now_impl(type, tz);
33
34exit:
35 return return_value;
36}
Serhiy Storchaka247789c2015-04-24 00:40:51 +030037/*[clinic end generated code: output=7f45c670d6e4953a input=a9049054013a1b77]*/