From 20d88dbf9803d93f89b8831f59f95b4d6c9f3aa1 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Mon, 27 Apr 2009 13:48:14 +0100 Subject: [PATCH] Retire timeoday.cpp Move the only function gettimeofday in misc.cpp where is used. This avoids polluting the global namespace. No functional change. Signed-off-by: Marco Costalba --- src/misc.cpp | 23 ++++++++++++++++++++++- src/timeoday.cpp | 28 ---------------------------- 2 files changed, 22 insertions(+), 29 deletions(-) delete mode 100644 src/timeoday.cpp diff --git a/src/misc.cpp b/src/misc.cpp index 1c16726e..281d8595 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -29,11 +29,32 @@ # include #else +/* + (c) Copyright 1992 Eric Backus + This software may be used freely so long as this copyright notice is + left intact. There is no warrantee on this software. +*/ # include # include # include "dos.h" -int gettimeofday(struct timeval * tp, struct timezone * tzp); +static int gettimeofday(struct timeval* tp, struct timezone*) +{ + SYSTEMTIME systime; + + if (tp) + { + struct tm tmrec; + time_t theTime = time(NULL); + + tmrec = *localtime(&theTime); + tp->tv_sec = mktime(&tmrec); + GetLocalTime(&systime); /* system time */ + + tp->tv_usec = systime.wMilliseconds * 1000; + } + return 0; +} #endif diff --git a/src/timeoday.cpp b/src/timeoday.cpp deleted file mode 100644 index 6909c2dc..00000000 --- a/src/timeoday.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - (c) Copyright 1992 Eric Backus - - This software may be used freely so long as this copyright notice is - left intact. There is no warrantee on this software. -*/ - -#include -#include -#include "dos.h" - -int gettimeofday(struct timeval* tp, struct timezone*) -{ - SYSTEMTIME systime; - - if (tp) - { - struct tm tmrec; - time_t theTime = time(NULL); - - tmrec = *localtime(&theTime); - tp->tv_sec = mktime(&tmrec); - GetLocalTime(&systime); /* system time */ - - tp->tv_usec = systime.wMilliseconds * 1000; - } - return 0; -} -- 2.39.2