-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add time zone handling APIs #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
============================================
+ Coverage 88.81% 91.73% +2.91%
- Complexity 44 61 +17
============================================
Files 10 13 +3
Lines 304 363 +59
Branches 69 89 +20
============================================
+ Hits 270 333 +63
+ Misses 23 22 -1
+ Partials 11 8 -3
Continue to review full report at Codecov.
|
native/src/main/java/io/ballerina/stdlib/time/nativeimpl/TimeZoneExternMethods.java
Outdated
Show resolved
Hide resolved
isolated function testGetZone() returns Error? { | ||
Zone? systemZone1 = getZone("Asia/Colombo"); | ||
if systemZone1 is Zone { | ||
test:assertTrue(systemZone1.fixedOffset() is ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this a fixed offset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially thought that too. But seems it is not a fixed offset.
ZoneId.of("Asia/Colombo").normalized().getRules().isFixedOffset(); // Returns false
And even the IANA time zone dataset has these changes as well.
# Sri Lanka
# From Paul Eggert (2013-02-21):
# Milne says "Madras mean time use from May 1, 1898. Prior to this Colombo
# mean time, 5h. 4m. 21.9s. F., was used." But 5:04:21.9 differs considerably
# from Colombo's meridian 5:19:24, so for now ignore Milne and stick with
# Shanks and Pottenger.
# From Paul Eggert (1996-09-03):
# "Sri Lanka advances clock by an hour to avoid blackout"
# (<http://www.virtual-pc.com/lankaweb/news/items/240596-2.html>, 1996-05-24,
# no longer available as of 1999-08-17)
# reported "the country's standard time will be put forward by one hour at
# midnight Friday (1830 GMT) 'in the light of the present power crisis'."
#
# From Dharmasiri Senanayake, Sri Lanka Media Minister (1996-10-24), as quoted
# by Shamindra in Daily News - Hot News Section
# <news:[email protected]> (1996-10-26):
# With effect from 12.30 a.m. on 26th October 1996
# Sri Lanka will be six (06) hours ahead of GMT.
# From Jesper Nørgaard Welen (2006-04-14), quoting Sri Lanka News Online
# <http://news.sinhalaya.com/wmview.php?ArtID=11002> (2006-04-13):
# 0030 hrs on April 15, 2006 (midnight of April 14, 2006 +30 minutes)
# at present, become 2400 hours of April 14, 2006 (midnight of April 14, 2006).
# From Peter Apps and Ranga Sirila of Reuters (2006-04-12) in:
# http://today.reuters.co.uk/news/newsArticle.aspx?type=scienceNews&storyID=2006-04-12T172228Z_01_COL295762_RTRIDST_0_SCIENCE-SRILANKA-TIME-DC.XML
# [The Tamil Tigers] never accepted the original 1996 time change and simply
# kept their clocks set five and a half hours ahead of Greenwich Mean
# Time (GMT), in line with neighbor India.
# From Paul Eggert (2006-04-18):
# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
# From Sadika Sumanapala (2016-10-19):
# According to http://www.sltime.org (maintained by Measurement Units,
# Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka
# standard time is SLST.
#
# From Paul Eggert (2016-10-18):
# "SLST" seems to be reasonably recent and rarely-used outside time
# zone nerd sources. I searched Google News and found three uses of
# it in the International Business Times of India in February and
# March of this year when discussing cricket match times, but nothing
# since then (though there has been a lot of cricket) and nothing in
# other English-language news sources. Our old abbreviation "LKT" is
# even worse. For now, let's use a numeric abbreviation; we can
# switch to "SLST" if it catches on.
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Asia/Colombo 5:19:24 - LMT 1880
5:19:32 - MMT 1906 # Moratuwa Mean Time
5:30 - +0530 1942 Jan 5
5:30 0:30 +06 1942 Sep
5:30 1:00 +0630 1945 Oct 16 2:00
5:30 - +0530 1996 May 25 0:00
6:30 - +0630 1996 Oct 26 0:30
6:00 - +06 2006 Apr 15 0:30
5:30 - +0530
Purpose
Fixes ballerina-platform/ballerina-library#1059
Examples
Checklist