Documentation

update_timezones.php

Simple Machines Forum (SMF)

Tags
author

Simple Machines https://www.simplemachines.org

copyright

2025 Simple Machines and individual contributors

license

https://www.simplemachines.org/about/smf/license.php BSD

version
3.0

Alpha 2

This is an internal development file. It should NOT be included in any SMF distribution packages.

This file exists to make it easier for devs to update Sources/TimeZone.php and Languages/en_US/Timezone.php when a new version of the IANA's time zone database is released.

Run this file from the command line in order to perform the update, then review any changes manually before committing.

In particular, review the following:

  1. If new $txt or $tztxt strings were added to the language file, check that they are spelled correctly and make sense.

  2. If the TZDB added an entirely new time zone, a new chunk of fallback code will be added to TimeZone::$fallbacks, with an "ADD INFO HERE" comment above it.

    • Replace "ADD INFO HERE" with something meaningful before committing, such as a comment about when the new time zone was added to the TZDB and which existing time zone it diverged from. This info can be found at https://data.iana.org/time-zones/tzdb/NEWS.
  3. When this script suggests a fallback tzid in the fallback code, it will insert an "OPTIONS" comment above that suggestion listing other tzids that could be used instead.

    • If you like the automatically suggested tzid, just delete the comment.

    • If you prefer one of the other options, change the suggested tzid to that other option, and then delete the comment.

    • All "OPTIONS" comments should be removed before committing.

  4. Newly created time zones are also appended to their country's list in the TimeZone::$sorted_tzids array.

    • Adjust the position of the new tzid in that list by comparing the city's population with the populations of the other listed cities. A quick Google or Wikipedia search is your friend here.
  5. If a new "meta-zone" is required, new entries for it will be added to TimeZone::$metazones and to the $tztxt array in the language file.

    • The new entry in TimeZone::$metazones will have an "OPTIONS" comment listing all the tzids in this new meta-zone. Feel free to use any of them as the representative tzid for the meta-zone. All "OPTIONS" comments should be removed before committing.

    • Also feel free to edit the $tztxt key for the new meta-zone. Just make sure to use the same key in both files.

    • The value of the $tztxt string in the language file will probably need to be changed, because only a human can know what it should really be.

Table of Contents

Classes

TimezoneUpdater
Updates SMF's time zone data.
Lang
A cheap stand-in for the real Lang class.

Constants

SMF  = basename(__FILE__)
SMF_SOFTWARE_YEAR  = $matches[1]
SMF_USER_AGENT  = 'SMF'
SMF_VERSION  = $matches[1]

Constants


        
On this page

Search results