static TimeZone()
{
try
{
loadIndex();
}
catch (Exception e)
{
System.Console.WriteLine("ERROR: Cannot load timezone database");
Err.dumpStack(e);
}
try
{
m_utc = fromStr("Etc/UTC");
}
catch (Exception e)
{
System.Console.WriteLine("ERROR: Cannot init UTC timezone");
Err.dumpStack(e);
m_utc = loadFallback("Etc/UTC", "UTC");
}
try
{
m_rel = fromStr("Etc/Rel");
}
catch (Exception e)
{
System.Console.WriteLine("ERROR: Cannot init Rel timezone");
Err.dumpStack(e);
m_rel = loadFallback("Etc/Rel", "Rel");
}
try
{
// first check system property
string sysProp = (string)Env.cur().vars().get("fan.timezone");
if (sysProp != null)
{
m_cur = fromStr(sysProp);
}
// we assume Java default uses Olson name
else
{
// TODO - no clue how to auto map this yet
//cur = fromStr(java.util.TimeZone.getDefault().getID());
m_cur = fromStr("America/New_York");
}
}
catch (Exception e)
{
System.Console.WriteLine("ERROR: Cannot init current timezone");
Err.dumpStack(e);
m_cur = m_utc;
}
}