shithub: npe

ref: 8400240efda16e4261a17eac0f5b719701b16cd8
dir: /libnpe/gmtime.c/

View raw version
#include <time.h>

#undef gmtime

static struct tm tm;

struct tm *
npe_gmtime(time_t *timep)
{
	time_t ti;
	Tm *t;

	ti = timep ? *timep : time(nil);
	if((t = gmtime(ti)) != nil){
		tm.tm_sec = t->sec;
		tm.tm_min = t->min;
		tm.tm_hour = t->hour;
		tm.tm_mday = t->mday;
		tm.tm_mon = t->mon;
		tm.tm_year = t->year;
		tm.tm_wday = t->wday;
		tm.tm_yday = t->yday;
		tm.tm_isdst = 0; /* FIXME */
		tm.tm_zone = "GMT";
	}

	return &tm;
}