From e8b3ac74a65185aafa3c812a5aae0458fbba8217 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 21 Sep 2009 14:44:35 +0000 Subject: [PATCH] ftime() --- lib/stdtime/Makefile.in | 1 + lib/stdtime/ftime.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lib/stdtime/ftime.c diff --git a/lib/stdtime/Makefile.in b/lib/stdtime/Makefile.in index 3efdcb255..64eb936a5 100644 --- a/lib/stdtime/Makefile.in +++ b/lib/stdtime/Makefile.in @@ -6,6 +6,7 @@ CFLAGS="-D_MINIX -D_POSIX_SOURCE -D__USG -I$Z" LIBRARIES=libc libc_FILES=" + ftime.c asctime.c localtime.c strftime.c diff --git a/lib/stdtime/ftime.c b/lib/stdtime/ftime.c new file mode 100644 index 000000000..cf4c30e70 --- /dev/null +++ b/lib/stdtime/ftime.c @@ -0,0 +1,24 @@ +/* Ported from glibc */ + +#include +#include + +int ftime(struct timeb *timebuf) +{ + struct timeval tv; + struct timezone tz; + + if (gettimeofday (&tv, &tz) < 0) + return -1; + + timebuf->time = tv.tv_sec; + timebuf->millitm = (tv.tv_usec + 500) / 1000; + if (timebuf->millitm == 1000) + { + ++timebuf->time; + timebuf->millitm = 0; + } + timebuf->timezone = tz.tz_minuteswest; + timebuf->dstflag = tz.tz_dsttime; + return 0; +} -- 2.44.0