Example #1
0
Array TimeZone::GetAbbreviations() {
  Array ret;
  for (const timelib_tz_lookup_table *entry =
         timelib_timezone_abbreviations_list(); entry->name; entry++) {
    ArrayInit element(3);
    element.set(s_dst, (bool)entry->type);
    element.set(s_offset, entry->gmtoffset);
    if (entry->full_tz_name) {
      element.set(s_timezone_id, String(entry->full_tz_name, CopyString));
    } else {
      element.set(s_timezone_id, uninit_null());
    }
    ret.lvalAt(String(entry->name)).append(element.create());
  }
  return ret;
}
Example #2
0
Array TimeZone::GetAbbreviations() {
  Array ret;
  for (const timelib_tz_lookup_table *entry =
         timelib_timezone_abbreviations_list(); entry->name; entry++) {
    Array element;
    element.set("dst", (bool)entry->type);
    element.set("offset", entry->gmtoffset);
    if (entry->full_tz_name) {
      element.set("timezone_id", String(entry->full_tz_name, AttachLiteral));
    } else {
      element.set("timezone_id", null);
    }

    ret.lvalAt(entry->name).append(element);
  }
  return ret;
}