Hi! Here is first prototype of a system package, which worth discuss.
I have put the RDB$ prefix on the package name, as liking very much or not, is the system prefix of Firebird objects. I did not named its sub routines or they parameters with RDB$ prefix. That's totally annoying and unnecessary. I added the _UTIL suffix as there is already and will not be removed the virtual table RDB$TIME_ZONES. I think RDB$TIME_ZONE name for the package would be hence confusing. Here is the usage of the two current sub routines. Function DATABASE_VERSION ----------- SQL> select rdb$time_zone_util.database_version() from rdb$database; DATABASE_VERSION ================ 2017c ----------- It worth discuss the name conversion. Should it be prefixed by GET_ (DATABASE_VERSION)? Procedure TRANSITION_RULES ----------- SQL> set list on; SQL> SQL> select * from rdb$time_zone_util.transition_rules( CON> 'America/Sao_Paulo', CON> date '2016-01-01', CON> date '2019-12-31'); RULE_START 2015-10-18 03:00:00.0000 GMT RULE_END 2016-02-21 01:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 60 RULE_START 2016-02-21 02:00:00.0000 GMT RULE_END 2016-10-16 02:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 0 RULE_START 2016-10-16 03:00:00.0000 GMT RULE_END 2017-02-19 01:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 60 RULE_START 2017-02-19 02:00:00.0000 GMT RULE_END 2017-10-15 02:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 0 RULE_START 2017-10-15 03:00:00.0000 GMT RULE_END 2018-02-18 01:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 60 RULE_START 2018-02-18 02:00:00.0000 GMT RULE_END 2018-10-21 02:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 0 RULE_START 2018-10-21 03:00:00.0000 GMT RULE_END 2019-02-17 01:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 60 RULE_START 2019-02-17 02:00:00.0000 GMT RULE_END 2019-10-20 02:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 0 RULE_START 2019-10-20 03:00:00.0000 GMT RULE_END 2020-02-16 01:59:59.9999 GMT ZONE_OFFSET -180 DST_OFFSET 60 ----------- It list all transition rules from the start to the end date, including the pre-start and post-end in the same rule set of start and end respectively. I'm deliberately returning the timestamps in GMT time zone, but they can be easily converted to the wanted one. The input parameter names are TIMEZONE_NAME, FROM_TIMESTAMP and TO_TIMESTAMP. The name convention also worth discuss, should it be prefixed by GET_ or LIST_ ? For GMT it will list: ----------- SQL> select * from rdb$time_zone_util.transition_rules( CON> 'GMT', CON> date '2016-01-01', CON> date '2019-12-31'); RULE_START 0001-01-01 00:00:00.0000 GMT RULE_END 9999-12-31 23:59:59.9999 GMT ZONE_OFFSET 0 DST_OFFSET 0 ----------- Adriano ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel