scc

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

_tzone.c (396B)


      1 #include <stdlib.h>
      2 #include <time.h>
      3 #include "../../libc.h"
      4 
      5 struct tzone *
      6 _tzone(struct tm *tm)
      7 {
      8 	static struct tzone tz;
      9 	static int first = 1;
     10 
     11 	if (!first)
     12 		return &tz;
     13 
     14 	tz.name = getenv("TZ");
     15 	if (!tz.name || *tz.name == '\0') {
     16 		tz.name = NULL;
     17 		tz.gmtoff = 0;
     18 		tz.isdst = 0;
     19 	} else {
     20 		/* TODO: parse TZ string */
     21 		tz.gmtoff = 0;
     22 		tz.isdst = 0;
     23 	}
     24 	first = 0;
     25 
     26 	return &tz;
     27 }