I came across this site when developing furious_tv and trying to figure
out the named timezones:
http://developer.postgresql.org/docs/postgres/datetime-keywords.html .
I just saved that web page, cut out the appropriate part and used sed to
convert it into simple C code. Keep in mind that some zones, like EST,
have different names in different regions. So it's a good thing that the
0.6 DTD says that times will be in UTC.
For what it's worth, here's the code I used in furious_tv (
http://furioustv.sourceforge.net/ ):
switch (*tz) {
case '-':
case '+':
combined = atoi(tz);
break;
case 'A':
if (!strcmp(tz, "ACSST")) combined = 1030;
if (!strcmp(tz, "ACST")) combined = 930;
if (!strcmp(tz, "ADT")) combined = -300;
if (!strcmp(tz, "AESST")) combined = 1100;
if (!strcmp(tz, "AEST")) combined = 1000;
if (!strcmp(tz, "AHST")) combined = -1000;
if (!strcmp(tz, "AST")) combined = -400;
if (!strcmp(tz, "AWSST")) combined = 900;
if (!strcmp(tz, "AWST")) combined = 800;
break;
case 'B':
if (!strcmp(tz, "BST")) combined = 100;
if (!strcmp(tz, "BT")) combined = 300;
break;
case 'C':
if (!strcmp(tz, "CADT")) combined = 1030;
if (!strcmp(tz, "CAST")) combined = 930;
if (!strcmp(tz, "CAT")) combined = -1000;
if (!strcmp(tz, "CCT")) combined = 800;
if (!strcmp(tz, "CDT")) combined = -500;
if (!strcmp(tz, "CET")) combined = 100;
if (!strcmp(tz, "CETDST")) combined = 200;
if (!strcmp(tz, "CST")) combined = -600;
break;
/* Urge to kill rising... */
case 'D':
if (!strcmp(tz, "DNT")) combined = 100;
if (!strcmp(tz, "DST")) combined = 100;
break;
case 'E':
if (!strcmp(tz, "EAST")) combined = 1000;
if (!strcmp(tz, "EDT")) combined = -400;
if (!strcmp(tz, "EET")) combined = 200;
if (!strcmp(tz, "EETDST")) combined = 300;
if (!strcmp(tz, "EST")) combined = -500;
break;
case 'F':
if (!strcmp(tz, "FST")) combined = 100;
if (!strcmp(tz, "FWT")) combined = 200;
break;
case 'G':
if (!strcmp(tz, "GMT")) combined = 0;
if (!strcmp(tz, "GST")) combined = 1000;
break;
case 'H':
if (!strcmp(tz, "HDT")) combined = -900;
break;
/* Rising... */
case 'I':
if (!strcmp(tz, "IDLE")) combined = 1200;
if (!strcmp(tz, "IDLW")) combined = -1200;
if (!strcmp(tz, "IST")) combined = 200;
if (!strcmp(tz, "IT")) combined = 330;
break;
case 'J':
if (!strcmp(tz, "JST")) combined = 900;
if (!strcmp(tz, "JT")) combined = 730;
break;
case 'K':
if (!strcmp(tz, "KST")) combined = 900;
break;
case 'L':
if (!strcmp(tz, "LIGT")) combined = 1000;
break;
case 'M':
if (!strcmp(tz, "MDT")) combined = -600;
if (!strcmp(tz, "MEST")) combined = 200;
if (!strcmp(tz, "MET")) combined = 100;
if (!strcmp(tz, "METDST")) combined = 200;
if (!strcmp(tz, "MEWT")) combined = 100;
if (!strcmp(tz, "MEZ")) combined = 100;
if (!strcmp(tz, "MST")) combined = -700;
if (!strcmp(tz, "MT")) combined = 830;
break;
case 'N':
if (!strcmp(tz, "NDT")) combined = -230;
if (!strcmp(tz, "NFT")) combined = -330;
if (!strcmp(tz, "NOR")) combined = 100;
if (!strcmp(tz, "NST")) combined = -330;
if (!strcmp(tz, "NT")) combined = -1100;
if (!strcmp(tz, "NZDT")) combined = 1300;
if (!strcmp(tz, "NZST")) combined = 1200;
if (!strcmp(tz, "NZT")) combined = 1200;
break;
case 'P':
if (!strcmp(tz, "PDT")) combined = -700;
if (!strcmp(tz, "PST")) combined = -800;
break;
/* Urge to kill fading... */
case 'S':
if (!strcmp(tz, "SADT")) combined = 1030;
if (!strcmp(tz, "SAT")) combined = 930;
if (!strcmp(tz, "SET")) combined = 100;
if (!strcmp(tz, "SST")) combined = 200;
if (!strcmp(tz, "SWT")) combined = 100;
break;
case 'W':
if (!strcmp(tz, "WADT")) combined = 800;
if (!strcmp(tz, "WAST")) combined = 700;
if (!strcmp(tz, "WAT")) combined = -100;
if (!strcmp(tz, "WDT")) combined = 900;
if (!strcmp(tz, "WET")) combined = 0;
if (!strcmp(tz, "WETDST")) combined = 100;
if (!strcmp(tz, "WST")) combined = 800;
break;
case 'Y':
if (!strcmp(tz, "YDT")) combined = -800;
if (!strcmp(tz, "YST")) combined = -900;
break;
case 'Z':
if (!strcmp(tz, "ZP4")) combined = -400;
if (!strcmp(tz, "ZP5")) combined = -500;
if (!strcmp(tz, "ZP6")) combined = -600;
break;
/* Urge to kill gone! */
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
|