21 lines
356 B
C
21 lines
356 B
C
#include <time.h>
|
|
#include "timeutil.h"
|
|
|
|
struct tm *gmtime(const time_t *timeptr)
|
|
{
|
|
static struct tm t;
|
|
|
|
/* Specify Epoch + *timeptr seconds */
|
|
t.tm_year = 1970 - 1900;
|
|
t.tm_mon = 0;
|
|
t.tm_mday = 1;
|
|
t.tm_hour = 0;
|
|
t.tm_min = 0;
|
|
t.tm_sec = *timeptr;
|
|
t.tm_isdst = 0;
|
|
|
|
/* Then let mktime() do all the hard work */
|
|
mktime(&t);
|
|
return &t;
|
|
}
|