* times.cc (settimeofday): Replace function stub with working code.

This commit is contained in:
Christopher Faylor 2001-02-26 22:36:09 +00:00
parent 88429768bb
commit 5b331f1ef1
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2001-02-26 Mike Simons <msimons@moria.simons-clan.com>
* times.cc (settimeofday): Replace function stub with working code.
Mon Feb 26 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de> Mon Feb 26 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de>
* strace.cc (strace::vprntf): Move prntf functionality to this function * strace.cc (strace::vprntf): Move prntf functionality to this function

View File

@ -17,6 +17,7 @@ details. */
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "perprocess.h"
#include "fhandler.h" #include "fhandler.h"
#include "path.h" #include "path.h"
#include "sync.h" #include "sync.h"
@ -92,10 +93,29 @@ _times (struct tms * buf)
/* settimeofday: BSD */ /* settimeofday: BSD */
extern "C" int extern "C" int
settimeofday (const struct timeval *, const struct timezone *) settimeofday (const struct timeval *tv, const struct timezone *tz)
{ {
set_errno (ENOSYS); SYSTEMTIME st;
return -1; struct tm *ptm;
int res;
tz = tz; /* silence warning about unused variable */
ptm = gmtime(&tv->tv_sec);
st.wYear = ptm->tm_year + 1900;
st.wMonth = ptm->tm_mon + 1;
st.wDayOfWeek = ptm->tm_wday;
st.wDay = ptm->tm_mday;
st.wHour = ptm->tm_hour;
st.wMinute = ptm->tm_min;
st.wSecond = ptm->tm_sec;
st.wMilliseconds = tv->tv_usec / 1000;
res = !SetSystemTime(&st);
syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz);
return res;
} }
/* timezone: standards? */ /* timezone: standards? */