public List <GPTimeZoneOld> getTimeZones() { if (tzonesList == null) { tzonesList = new List <GPTimeZoneOld>(); XmlNode node = getMainNode(); XmlElement elem = node as XmlElement; foreach (XmlElement item in elem.ChildNodes) { if (item.Name == "timezone") { GPTimeZoneOld tzone = new GPTimeZoneOld(); tzone.Id = LastId++; foreach (XmlElement subs in item.ChildNodes) { if (subs.Name == "name") { tzone.Name = subs.InnerText; } else if (subs.Name == "transition") { GPTimeZoneOld.Transition trans = new GPTimeZoneOld.Transition(); if (subs.HasAttribute("date")) { trans.setDateString(subs.GetAttribute("date")); } if (subs.HasAttribute("offset")) { int.TryParse(subs.GetAttribute("offset"), out trans.OffsetInSeconds); } if (subs.HasAttribute("abbr")) { trans.Abbreviation = subs.GetAttribute("abbr"); } if (subs.HasAttribute("dst")) { int dst = 0; int.TryParse(subs.GetAttribute("dst"), out dst); trans.Dst = ((dst == 1) ? true : false); if (trans.Dst == false) { tzone.OffsetSeconds = trans.OffsetInSeconds; } } tzone.Transitions.Add(trans); } } tzone.RefreshEnds(); if (tzone.Name.Length > 0) { tzonesList.Add(tzone); } } } } return(tzonesList); }
public double getTimeZoneOffsetHours() { GPLocation loc = getLocation(); if (loc == null) { return(0); } GPTimeZoneOld tz = loc.getTimeZone(); if (tz == null) { return(0); } return(tz.OffsetSeconds / 3600.0); }
// textual representation of timezone base offset public string getOffsetString() { return(GPTimeZoneOld.SecondsToString(OffsetInSeconds, 2)); }