scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

localtime.c (336B)


      1 #include <time.h>
      2 
      3 #include "../libc.h"
      4 #undef localtime
      5 
      6 struct tm *
      7 localtime(const time_t *timep)
      8 {
      9 	struct tzone *tz;
     10 	struct tm *tm;
     11 	time_t t = *timep;
     12 
     13 	t += tz->gmtoff * 60;
     14 	t += tz->isdst * 60;
     15 	tm = gmtime(&t);
     16 	tz = _tzone(tm);
     17 	tm->tm_zone = tz->name;
     18 	tm->tm_isdst = tz->isdst;
     19 	tm->tm_gmtoff = tz->gmtoff;
     20 
     21 	return tm;
     22 }