mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
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 <mcostalba@gmail.com>
This commit is contained in:
parent
ef60043725
commit
20d88dbf98
2 changed files with 22 additions and 29 deletions
23
src/misc.cpp
23
src/misc.cpp
|
@ -29,11 +29,32 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|
||||||
#else
|
#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 <windows.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
# include "dos.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;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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 <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;
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue