Time Zones How To
from the mailing list
http://mail.opengroupware.org/pipermail/users/2003-July/004667.html>I was wondering how you can change the time zones? I am situated in > Australia and want to set it up for the zones over here. Does anyone know > how I can do this or can point me in the right direction?
You need to change the LSTimeZones Defaults, eg: Defaults write OpenGroupware LSTimeZones "(AST,GMT,PST,MET)" What timezones do you have in Australia, probably more than one ? Might be that we need to add some timezone descriptions to libFoundation.
Location of timezone definitions for OpenGroupware.org
The timezone definitions are part of libFoundation and are installed into
/usr/local/share/libFoundation/TimeZoneInfo/
-bash-2.05b$ pwd
/usr/local/share/libFoundation/TimeZoneInfo
Time Zone definition files
[root@arc-rj-10k-01 TimeZoneInfo]# ls Africa/ GMT-10 GMT-3 GMT-7_30 Poland Asia/ GMT+10 GMT+3 GMT+7_30 PST8PDT Australia/ GMT-10_30 GMT-3_30 GMT-8 RegionsDictionary Brasil/ GMT+10_30 GMT+3_30 GMT+8 Canada/ GMT-11 GMT-4 GMT-8_30 CET GMT+11 GMT+4 GMT+8_30 SAST CLST GMT-11_30 GMT-4_30 GMT-9 SGT CST6CDT GMT+11_30 GMT+4_30 GMT+9 Singapore EET GMT-12 GMT-5 GMT-9_30 SystemV/ EST GMT+12 GMT+5 GMT+9_30 Turkey EST5EDT GMT+13 GMT-5_30 Greenwich UCT Europe/ GMT-1_30 GMT+5_30 HST Universal GB-Eire GMT+1_30 GMT-6 Iceland US/ GMT GMT+14 GMT+6 Japan UTC GMT-0_30 GMT-2 GMT-6_30 MET WET GMT+0_30 GMT+2 GMT+6_30 MST W-SU GMT-1 GMT-2_30 GMT-7 MST7MDT GMT+1 GMT+2_30 GMT+7 NZ
The sample above is useful when the time zone has a known name (MET, AST, GMT, etc... ).
To set the time zone at GMT-3, GMT-2, GMT-1, GMT :
For both OpenGroupware and Zidestore, use NSGlobalDomain...
Defaults write NSGlobalDomain LSTimeZones "(GMT-0300,GMT-0200,GMT-0100,GMT)"Or you can define time zones individually for ZideStore and OpenGroupware...
Defaults write ogo-webui-1.0a LSTimeZones "(GMT-0300,GMT-0200,GMT-0100,GMT)" Defaults write ogo-zidestore-1.3 LSTimeZones "(GMT-0300,GMT-0200,GMT-0100,GMT)"
Note that the value "GMT-0300" is NOT the file GMT-3 in the /TimeZone directory, but the actual time zone name. The correspondence between the time zone name and the files above is given by the file "RegionDictionary" in the directory above.
Adding new Time Zones to OpenGroupware.org
As an example, we will add Brazil timezones to OpenGroupware:
The time zone matter in Brazil is not so often used. For historical reasons, the largest part of the country GNP is by far, under Brasilia time zone (GMT-3). The other time zones are in remote regions with scarse population. Time zones names are thus more related to regions rather than international abbreviations. We will then use Brasilia, Nordeste, Amazônia and Acre as names for our Brazilian time zones. That will make our local OpenGroupware.org users life easier.
Brazil's timezones official references (in portuguese) can be found here:
Source: Brazil National Observatory.
Source: Brazil States vs time zones.
Source: Daylight saving time (DST) in Brazil.
Source: Brazil States map vs Time zones.
-
Timezone name
GMT offset
Brasilia:
GMT-3
Nordeste:
GMT-3
Amazonia:
GMT-4
Acre:
GMT-5
You must log in as root, and follow the steps:
go to /usr/local/share/libFoundation/TimeZoneInfo/
Create a sub-directory named Brasil to hold Brazil regions files
mkdir Brasil
cd BrasilCreate a file named Brasilia, with the contents below:
[root@opengroupware Brasil]# cat Brasilia { details = { Brasilia = {abbrev = "Brasilia"; isDST = 0; offset = "-3:00:00"; }; BrasiliaHV = {abbrev = "BrasiliaHV"; isDST = 1; offset = "-2:00:00"; }; }; rules = ( { /* 2004 */ startDate = "Thu Jan 01 02:00:00 2004 GMT"; endDate = "Fri Dec 31 02:00:00 2004 GMT"; transitions = ( { date = "February/third Sunday/02:00:00"; detail = Brasilia; }, { date = "November/first Tuesday/02:00:00"; detail = BrasiliaHV; } ); }, /* 2005 */ { startDate = "Sat Jan 01 02:00:00 2005 GMT"; endDate = "Sat Dec 31 02:00:00 2005 GMT"; transitions = ( { date = "February/third Sunday/02:00:00"; detail = Brasilia; }, /* to be confirmed: */ { date = "October/third Sunday/02:00:00"; detail = BrasiliaHV; } ); } ); }- Hacking a little (got no answer from Google on the exact meaning of the content of this file...), my best guess so far is:
- Brasilia and BrasiliaHV reference for transition below.
- abbrev is the name that will appear at session expiration in the web interface and in the Agenda timezone pull-down menu. This name must match one entry in the "Abbreviation" part of file RegionDictionary, and must not contain accented letters (OpenGroupware will not complain but will miscalculate your time and date).
- isDST is a flag to signal DST state and offset is the GMT offset of the time zone with its DST value.
- rules: startDate is a string defining a date where the rule start to apply, endDate, is the end date of the rule. Note that the example given applies only to 2004 & 2005.
- transition: specify the dates to switch DST on and off. Parameter "detail" refers to the detail on top.
Do the same for files "Acre", "Amazonia" and "Nordeste", with the proper timezone shift (parameter "offset").
Other files in directory Australia/ seems to have more information. Unfortunately, there is no algebraic rule for DST exact dates in Brazil (issued by Government decree, only weeks before it get effective), but usually Brazil's DST start mid October and ends mid February.NOTE Northern regions in Brazil (Acre, Amazonia and Nordeste) will not have a DST in 2004-2005. This is becasue DST is almost useless when one lives close to the Equator, and to avoid the annoyance of waking up hours before sunrise, DST will not apply there.
Edit file RegionsDictionary and add the following lines near "Abbreviations". In this part of the file, the time zones abbreviations will map to the regions files.
GMT = GMT; "GMT+0100" = "GMT+1"; "GMT+0200" = "GMT+2"; "GMT+0300" = "GMT+3"; Brasilia = "Brasil/Brasilia"; BrasiliaHV = "Brasil/Brasilia"; Nordeste = "Brasil/Nordeste"; Amazonia = "Brasil/Amazonia"; Acre = "Brasil/Acre"; "GMT+0400" = "GMT+4"; "GMT+0500" = "GMT+5"; "GMT+0600" = "GMT+6";Edit the same file near RegionsByOffset. In this part of the file, the time zone offset will map to the regions files.
RegionsByOffset = { (snip) "-0600" = ( "GMT-6", "US/Central", "Canada/Central", "Canada/East-Saskatchewan", "CST6CDT" ); "-0500" = ("GMT-5","US/Eastern", "US/East-Indiana", "Canada/Eastern", "Brasil/Acre"); "-0400" = ("GMT-4", "Canada/Atlantic",EST, "EST5EDT","Brasil/Amazonia"); "-0330" = ("Canada/Newfoundland"); "-0300" = ("GMT-3", "Brasil/Brasilia", "Brasil/Nordeste"); "-0200" = ("GMT-2"); "-0100" = ("GMT-1"); (snip)- Stop OpenGroupware server
# service ogo-webui-1.0a stop
log in as opengroupware
# su – ogo
Issue the new time zone Defaults
Defaults write NSGlobalDomain LSTimeZones "(Acre, Amazonia, Nordeste, Brasilia)" or Defaults write ogo-webui-1.0a LSTimeZones "(Acre, Amazonia, Nordeste, Brasilia)" Defaults write ogo-zidestore-1.3 LSTimeZones "(Acre, Amazonia, Nordeste, Brasilia)"
- Exit user ogo and return to user root, then start opengroupware service:
# service ogo-webui-1.0a restart
Voilà!
New time zones should appear in the WebUI. Go to Preferences - Display.
Content of Nordeste, Amazonia and Acre files:
cat Nordeste
{
details = {
Nordeste = {abbrev = "Nordeste"; isDST = 0; offset = "-3:00:00"; };
};
}
cat Amazonia
{
details = {
Amazonia = {abbrev = "Amazonia"; isDST = 0; offset = "-4:00:00"; };
};
}
cat Acre
{
details = {
Acre = {abbrev = "Acre"; isDST = 0; offset = "-5:00:00"; };
};
}