pike.git
/
lib
/
modules
/
Calendar.pmod
/
TZnames.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Calendar.pmod/TZnames.pmod:1:
// ---------------------------------------------------------------- // Timezone names // // this file is created half-manually // ---------------------------------------------------------------- //! module Calendar //! submodule TZnames //! This module contains listnings of available timezones, //! in some different ways
+
+
#pike __REAL_VERSION__
+
+
//! method string _zone_tab()
+
//! method array(array) zone_tab()
+
//! This returns the raw respectively parsed zone tab file
+
//! from the timezone data files.
//!
-
+
//! The parsed format is an array of zone tab line arrays,
+
//! <pre>
+
//! ({ string country_code,
+
//! string position,
+
//! string zone_name,
+
//! string comment })
+
//! </pre>
+
//!
+
//! To convert the position to a Geography.Position, simply
+
//! feed it to the constructor.
+
+
static string raw_zone_tab=0;
+
string _zone_tab()
+
{
+
return raw_zone_tab ||
+
(raw_zone_tab = Stdio.read_bytes(
+
combine_path(__FILE__,"..","tzdata/zone.tab")));
+
}
+
+
static array(array(string)) parsed_zone_tab=0;
+
array(array(string)) zone_tab()
+
{
+
return parsed_zone_tab ||
+
(parsed_zone_tab=
+
map(_zone_tab()/"\n",
+
lambda(string s)
+
{
+
if (s=="" || s[0]=='#')
+
return 0;
+
else
+
{
+
array v=s/"\t";
+
if (sizeof(v)==3) return v+=({""});
+
else return v;
+
}
+
})
+
-({0}));
+
}
+
+
//! method array(string) zonenames()
+
//! This reads the zone.tab file and returns name of all
+
//! standard timezones, like "Europe/Belgrade".
+
+
static array(string) zone_names=0;
+
array(string) zonenames()
+
{
+
return zone_names || (zone_names=column(zone_tab(),2));
+
}
+
//! constant mapping(string:array(string)) zones //! This constant is a mapping that can be //! used to loop over to get all the region-based //! timezones. //! //! It looks like this: //! <pre> //! ([ "America": ({ "Los_Angeles", "Chicago", <i>[...]</i> }), //! "Europe": ({ "Stockholm", <i>[...]</i> }), //! <i>[...]</i> }), //! </pre> //! //! Please note that loading all the timezones can take some //! time, since they are generated and compiled on the fly.
-
#pike __REAL_VERSION__
-
+
mapping zones= ([ "America": ({"Scoresbysund","Godthab","Thule","New_York","Chicago", "Denver","Los_Angeles","Juneau","Yakutat","Anchorage", "Nome","Adak","Phoenix","Boise","Indianapolis", "Indiana/Marengo","Indiana/Knox","Indiana/Vevay", "Louisville","Detroit","Menominee","St_Johns","Goose_Bay", "Halifax","Glace_Bay","Montreal","Thunder_Bay","Nipigon", "Rainy_River","Winnipeg","Regina","Swift_Current", "Edmonton","Vancouver","Dawson_Creek","Pangnirtung",
pike.git/lib/modules/Calendar.pmod/TZnames.pmod:1365:
-3600:"Europe/Madrid", -7200:"Europe/Prague",]),]), -7200: ([ "test":-788918400, // 1945-01-01 00:00:00 -7200:"Europe/Amsterdam", -3600: ([ "test":-1283472000, // 1929-05-01 00:00:00 -3600:"Europe/Luxembourg", 0:"Europe/Brussels",]),]),]),]),]), -7200:"Europe/Warsaw",]),]),]);
+
+