Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12460 > unrolled thread
| Started by | Andreas <aww.dev@googlemail.com> |
|---|---|
| First post | 2011-08-31 05:39 +0200 |
| Last post | 2011-08-31 05:39 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Usage of PyDateTime_FromTimestamp Andreas <aww.dev@googlemail.com> - 2011-08-31 05:39 +0200
| From | Andreas <aww.dev@googlemail.com> |
|---|---|
| Date | 2011-08-31 05:39 +0200 |
| Subject | Re: Usage of PyDateTime_FromTimestamp |
| Message-ID | <mailman.592.1314761989.27778.python-list@python.org> |
Am 30.08.2011 23:49, schrieb MRAB:
> The key phrase is "argument tuple". The arguments passed to a Python
> call are always a tuple, not PyFloat_Object.
>
> You can build a tuple from the PyFloat_Object using:
>
> Py_BuildValue("(O)", float_object)
>
> The "(O)" says to build a tuple ("(...)") containing a single object
> ("O").
Thank you very much! That solved my problem.
Here the full working example:
static double doubleValue = 1314761451;
PyObject *floatObj = NULL;
PyObject *timeTuple = NULL;
PyObject *dateTime = NULL;
floatObj = PyFloat_FromDouble(doubleValue);
timeTuple = Py_BuildValue("(O)", floatObj);
dateTime = PyDateTime_FromTimestamp(timeTuple);
Back to top | Article view | comp.lang.python
csiph-web