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 <mcostalba@gmail.com>
# include <unistd.h>
#else
# include <unistd.h>
#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 <windows.h>
# include <time.h>
# include "dos.h"
# include <windows.h>
# include <time.h>
# 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;
+}
+++ /dev/null
-/*
- (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 <windows.h>
-#include <time.h>
-#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;
-}