summaryrefslogtreecommitdiff
path: root/_obnammodule.c
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-05-18 11:09:47 +0100
committerLars Wirzenius <liw@liw.fi>2011-05-18 11:09:47 +0100
commit9a414a374dd8f2a9a953d5c9e1603655672678fe (patch)
tree702b41dbef166a526100313579a499f94c6757bb /_obnammodule.c
parentbe3470c3c54c2ccaf1872c1fd2833638a259c6f5 (diff)
downloadobnam-9a414a374dd8f2a9a953d5c9e1603655672678fe.tar.gz
Change the lutimes(2) wrapper to deal with fractional seconds.
Diffstat (limited to '_obnammodule.c')
-rw-r--r--_obnammodule.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/_obnammodule.c b/_obnammodule.c
index e45acf8d..e32689b9 100644
--- a/_obnammodule.c
+++ b/_obnammodule.c
@@ -38,6 +38,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
+#include <sys/stat.h>
static PyObject *
@@ -61,17 +62,17 @@ static PyObject *
lutimes_wrapper(PyObject *self, PyObject *args)
{
int ret;
- long atime;
- long mtime;
- struct timeval tv[2];
const char *filename;
+ struct timeval tv[2];
- if (!PyArg_ParseTuple(args, "sll", &filename, &atime, &mtime))
+ if (!PyArg_ParseTuple(args, "sllll",
+ &filename,
+ &tv[0].tv_sec,
+ &tv[0].tv_usec,
+ &tv[1].tv_sec,
+ &tv[1].tv_usec))
return NULL;
- tv[0].tv_sec = atime;
- tv[0].tv_usec = 0;
- tv[1].tv_sec = mtime;
- tv[1].tv_usec = 0;
+
ret = lutimes(filename, tv);
if (ret == -1)
ret = errno;