PascalTZ

From Free Pascal wiki
Revision as of 17:20, 11 November 2009 by Joshy (talk | contribs)
Jump to navigationJump to search

About

PascalTZ stands for "Pascal Time Zone". It allows you to convert local times to GMT/UTC/Zulu and across time zones taking in account the different rules for this change on every time zone. PascalTZ uses the public database available at http://www.twinsun.com/tz/tz-link.htm to know how to change time for any past time (rules changed over the years) and it is almost 100% reliable for times in 20th and 21th century, and quite precise for prior times as some rules in 19th century and before were never properly documented. Time zone changes for the future times are not reliable as the rules can change sometimes suddenly like Venezuela 2007 change proposed a bunch of days before the change, or the 2009 Argentina ones.

The unit can:

  • Convert a given time/date in local time to/from GMT time.
  • Convert a given time/date across two zone times.
  • In the conversion process detect invalid times.
  • Be updateable simply upgrading the TZ Database

The download contains the component, an installation package and a demo application, that illustrates the features of the component along with some instrumentation for evaluating the component on a given system. The unit can also used in non Lazarus projects (plain fpc applications) as the unit does not require any user graphic interface but is included as a package for easy integration in applications.

Author

2009 - Jose Mejuto

License

modified LGPL (same as the FPC RTL and the Lazarus LCL). You can contact the author if the modified LGPL doesn't work with your project licensing.

Download

The latest stable release can be found on link to the lazarus-ccr sf download location (pending).

Change Log

  • Version 1.0 2009.11.10

Dependencies / System Requirements

Status: Stable

Issues: TDateTime in fpc seems to have problems for dates before 30 Dec 1899, so the time operations before such date could be wrong. If you need to operate with early dates you can derive a new class from TPascalTZ and expose the TTZDateTime to operate with.

Installation

  • Just add the upascaltz to the uses clause of your project.
  • Load a database in a new instance of the class.