Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_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_FASTCALL|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
     18 
     19 static PyObject *
     20 datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
     21 
     22 static PyObject *
     23 datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
     24 {
     25     PyObject *return_value = NULL;
     26     static const char * const _keywords[] = {"tz", NULL};
     27     static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
     28     PyObject *tz = Py_None;
     29 
     30     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
     31         &tz)) {
     32         goto exit;
     33     }
     34     return_value = datetime_datetime_now_impl(type, tz);
     35 
     36 exit:
     37     return return_value;
     38 }
     39 /*[clinic end generated code: output=1fc05897ab239b3f input=a9049054013a1b77]*/
     40