SlideShare a Scribd company logo
1 of 58
Download to read offline
WHY A WHOLE COUNTRY SKIPPED A DAY
FUN WITH TIMEZONES
KAI KOENIG (@AGENTK)
HELLO
HELLO
My name is Kai.
Software Architect in the Web and Android space.
Stuff I enjoy: Coding in Android, Kotlin, Java & CFML, compilers and parsers,
aviation and flying small aircraft, cats and chickens, Nintendo video games of all
ages.
Twitter: @AgentK
https://upload.wikimedia.org/wikipedia/commons/c/cd/Timezones2010.png
WHY THIS TALK?
https://www.flickr.com/photos/tschiae/8080742303/
?
SOME CONTEXT
https://www.flickr.com/photos/tschiae/8080742303/
Locations
Languages
Scripts
Cultures
We live in a large, complex and connected world
Times
EXAMPLES
▸ Spoken language, written language & scripts, reading direction, translations
▸ Decimal formats, currency symbols
▸ Meaning of colours, symbols, artworks in a cultural context
▸ Time formats & notation, time zones, boundaries, DST
SOME CONTEXT
TERMINOLOGY
▸ i18n: internationalisation
▸ Designing software in a way so it can be adapted to various languages
▸ l10n: localisation
▸ Adapting software for a certain region, time or language
SOME CONTEXT
SOME CONTEXT
LOCALES
▸ A locale is a set of parameters that defines the user's language, country and
any special variant preferences that the user wants to see in their user interface.
▸ A locale identifier consists of at least a language identifier and (usually) a
region identifier:
▸ de_DE vs. de_CH
▸ en_AU vs. en_NZ
▸ mi_NZ
SOME CONTEXT
TWO WORLDS
▸ Up to and including SDK 23:
▸ Limited exposure of ICU functionality in Android SDK
▸ ICU version-equivalent depends on SDK and in some rare cases on OEM.
▸ Suggestion: import ICU4J manually into your project
▸ From SDK 24 onwards:
▸ Subset of ICU4J is included in SDK, less need for additional library for better
i18n support.
TIME
https://www.flickr.com/photos/tschiae/8080742303/
https://www.flickr.com/photos/_pixelmaniac_/5635144783
https://www.flickr.com/photos/cienne/2058756459
Railroad time
16
https://www.flickr.com/photos/basecampbaker/11569555103
https://www.euratlas.net/cartogra/deutschland/index.html
MORE HISTORY
▸ Greenwich Mean Time (GMT)
▸ Started in 1675 as a local solar time
▸ Used by railway companies in the UK from ~1840 with portable
chronometers
TIME
EVEN MORE HISTORY
▸ November 1868:
▸ New Zealand Mean Time was introduced (GMT+11:30)
▸ Between 1860s-1890s:
▸ USA introduced the railroad time with 4 major time zone
TIME
TIME ON A GLOBAL LEVEL
▸ The Italian mathematician Filopanti suggested a 24hr time zone system
centred in Rome (1858).
▸ By ~1900 most of the Earth had standard time zones, not necessarily in
brackets of one hour.
▸ Today: Full hour, 1/2 hour and 1/4 hour time zones
▸ Also: politics play a big part
TIME
Each time zone spans 15 degrees of longitude
GMT VS UTC
▸ GMT: Mean solar time at the meridian passing through the Royal Observatory
in Greenwich
▸ UTC: Atomic time that includes leap seconds, guaranteed to always be within
0.9 seconds of the original GMT
▸ UTC is also known as Zulu Time
▸ Fun fact: Earth’s rotation is slowing - we’ll need more leap seconds and more
often
TIME
https://upload.wikimedia.org

/wikipedia/commons/6/61

/International_Date_Line.png
INTERNATIONAL DATE LINE
▸ An imaginary “line” in the Pacific Ocean.
▸ Crossing the IDL:
▸ East to West (North America -> Asia/Oceania): add a day
▸ West to East (Asia/Oceania -> North America): subtract a day
▸ Established in 1884 based on the 180 degrees Meridian
TIME
THE NEED FOR A TEMPORAL DISCONTINUITY ON
THE GLOBE CAN BE DESCRIBED MATHEMATICALLY
AS FOLLOWING FROM THE BORSUK-ULAM
THEOREM IN DIMENSION 1 

TIME
“IT IS A TOPOLOGICAL FACT THAT THERE DOES
NOT EXIST ANY CONTINUOUS, ONE-TO-ONE
FUNCTION MAPPING FROM A CIRCLE ONTO AN
INTERVAL.”
TIME
TIME FORMATS
▸ 09:30 UTC would usually be expressed as 09:30Z or 0930Z
▸ 14:45:15 UTC -> 14:45:15Z or 144515Z
▸ Offsets:
▸ +/-03:00 or +/-0300 or +/-03
▸ Terminology such as MEST, NZDT, BST etc. are made up and not standardised.
TIME
http://aa.usno.navy.mil/graphics/TimeZoneMap2017.png
TIME FORMATS
TIME
B3819/18 NOTAMR B3791/18
Q) NZZC/QLXXX/IV/NBO/A /000/999/4120S17448E005
A) NZWN B) 1806231919 C) 1806241800 EST
E) TWY A1 CL LGT WIP. INSTALLATION OF TEMPO BLUE TWY
EDGE LGT. TWY CL LGT AND BLUE TWY EDGE LGT MAY OPR
SIMULTANEOUSLY AS TWY LGT IS PROGRESSIVELY REPLACED
TIME FORMATS
TIME
B3819/18 NOTAMR B3791/18
Q) NZZC/QLXXX/IV/NBO/A /000/999/4120S17448E005
A) NZWN B) 1806231919 C) 1806241800 EST
E) TWY A1 CL LGT WIP. INSTALLATION OF TEMPO BLUE TWY
EDGE LGT. TWY CL LGT AND BLUE TWY EDGE LGT MAY OPR
SIMULTANEOUSLY AS TWY LGT IS PROGRESSIVELY REPLACED
DAYLIGHT SAVINGS TIME
▸ DST occurs when a country/region decides to wind their clocks forward one
hour to make most of the available sunlight.
▸ Might have a local name - Germany: “Sommerzeit” and “Winterzeit”
▸ Northern and Southern Hemisphere usually move in opposite directions.
▸ Lord Howe (an island between AU and NZ) has a DST of +0030
▸ Some other areas in Australia ignore DST - mainly West Australia and
Queensland — too many farmers that don’t want their cattle/sheep to be upset.
TIME
TIME ZONES IN JVM LAND
▸ TZ Database: IANA Time Zone Database
▸ Set of text files that can be read and used with the right tools. It’s safe to
assume you don’t have those tools and don’t care - most of the time.
▸ A JVM comes with a copy of the TZ Database built-in.
▸ It contains historic and current information on timezones for various locations
at any time of the year.
TIME
TIME ZONES IN JVM LAND
▸ It’s important to update your JVM’s timezone database regularly through JVM
updates or through manual patching.
▸ Time legislation changes over the years:
▸ DST start/end dates might be adjusted
▸ Political changes at will
▸ Examples:
▸ JRE 6u10- tzdata2008c
▸ JRE 6u191 - tzdata2018c
TIME
TIME AND ANDROID
▸ As users, we can’t update tzdata ourselves in any easy way:
▸ Usually baked into the ORM’s system image
▸ If one is root, there are some whacky ways to “fix” tzdata
▸ Hardware manufacturer updates… 🤔🙄
▸ Big changes in 8.1+ - TimeZone updater solution:
▸ Android team creates timezone rules updates
▸ OEMs can deploy them without full system upgrades
TIME
CODE AND APIS TO AVOID
▸ Don’t use the old, built-in Date and Calendar classes:
▸ java.util.Date
▸ SimpleDateFormatter etc.
▸ NOT thread-safe
▸ Weeeeeeeeird API
TIME
JODA TIME
▸ Third-party library to fix the problems of the Date/Time APIs pre-Java 8.
▸ Everyone used Joda Time at some point.
▸ Fixes tzdata update issue:
▸ Library releases get updates
▸ Manual patching if needed now
▸ https://www.joda.org/joda-time
TIME
JODA PROBLEMS
▸ End of life is on the horizon.
▸ Migration to JSR-310 (java.time) is suggested.
▸ Joda Time’s author was heavily involved with that effort.
▸ Android:
▸ Class loading
▸ Large memory footprint
▸ Joda Time Android: https://github.com/dlew/joda-time-android
TIME
THREETEN BP
▸ JSR-310 is only available for Java 8+.
▸ ThreeTenBP is a back port library of JSR-310 APIs to Java 6 and 7.
▸ Gotchas:
▸ Not actively developed, library is in “bug fix” mode.
▸ Not a JSR-310 implementation, merely an API back port.
▸ https://github.com/ThreeTen/threetenbp
▸ https://github.com/JakeWharton/ThreeTenABP
TIME
TIME
SOME GOOD PRACTICES
▸ If you can:
▸ Everywhere in your backend, store and manage time in UTC
▸ When passing time around between server and client, use UTC
▸ Presentation layer in clients (Android, iOS, Web etc) takes UTC time and
applies user’s timezone information, offsets for DST etc to it
▸ SDK 24+: Consider using android.icu.util package from ICU4J library
▸ https://developer.android.com/reference/android/icu/util/package-summary
TIME
EXCEPTIONS
▸ There are exceptions:
▸ Is it a good idea to store alarm clock values in UTC - or schedulers in
general?
▸ What if the user travels and changes timezone?
▸ What if the user’s timezone information is wrong in the first place?
TIME
▸ Australian Central Western Time - UTC
+0845
▸ Self-proclaimed timezone by 5
settlements in the desert.
TIME
▸ Time zones cross states
▸ Time zones can even cross counties
▸ Worst offenders:
▸ Kentucky
▸ Indiana
▸ Tennessee
TIME
▸ Island of Markets Fyr (Baltic Sea)
▸ Possibly the world’s smallest multi-
timezone location
https://www.flickr.com/photos/89281933@N03/12393619493
WTF ???
TIME
SAMOA
▸ Samoa skipped 30/12/2011 and moved across the International Date Line.









▸ Second big change for the country since changing from right-side driving to
left-side driving in 2009
▸ Tokelau followed their move
Samoa Mon 9-5 Tue 9-5 Wed 9-5 Thu 9-5 Fri 9-5 Sat 9-5 Sun 9-5
NZ Tue 8-4 Wed 8-4 Thu 8-4 Fri 8-4 Sat 8-4 Sun 8-4 Mon 8-4
AU (Syd) Tue 6-2 Wed 6-2 Thu 6-2 Fri 6-2 Sat 6-2 Sun 6-2 Mon 6-2
Samoa Mon 9-5 Tue 9-5 Wed 9-5 Thu 9-5 Fri 9-5 Sat 9-5 Sun 9-5
NZ Mon 8-4 Tue 8-4 Wed 8-4 Thu 8-4 Fri 8-4 Sat 8-4 Sun 8-4
AU (Syd) Mon 6-2 Tue 6-2 Wed 6-2 Thu 6-2 Fri 6-2 Sat 6-2 Sun 6-2
TIME
▸ Kiribati used to split across 2
days
▸ GMT+12
▸ GMT+13
▸ GMT-10
▸ In 1995, the easternmost group
of islands moved across the
International Date Line and
became GMT+14
TIME
OTHER ODDITIES
▸ Russia changed all their timezones in 2010 and then (partly) again in 2011 - created
a huge issue for a lot of the users of one of my clients (Russian/Ukrainian-focussed
sites and app).
▸ The International Space Station uses UTC.
▸ Spain should geographically be in the same time zone as the UK. Why aren’t they?
▸ During WW2, Spain’s dictator Franco wanted to align the Spanish time with Nazi-
Germany, their ally.
▸ UK was permanently on GMT+2 during WW2 - even though Greenwich is IN THE UK
OTHER THINGS AND
FINAL THOUGHTS
https://www.flickr.com/photos/chrispiascik/4054331891
OTHER THINGS
(NORTHERN HEMISPHERE) AUTUMN DST CHANGES FALLOUT
▸ 30 September 2018: NZ goes into DST (moves 1 hr East)
▸ 7 October 2018: AU (New South Wales) goes into DST (moves 1 hr East)
▸ 28 October 2018: Germany and UK leave DST (move 1 hr West)
- 30/9 30/9 - 7/10 7/10 - 28/10 28/10 -
NZ-AU +2 +3 +2 +2
NZ-Europe +10 +11 +11 +12
AU-Europe +8 +8 +9 +10
OTHER THINGS
RESOURCES (I)
▸ i18n support in Android:

https://developer.android.com/guide/topics/resources/internationalization
▸ ICU4J versioning:

https://developer.android.com/guide/topics/resources/internationalization#versioning-nougat
▸ IANA Time Zone Database:

http://en.wikipedia.org/wiki/Tz_database
▸ Oracle TZ technote: 

http://www.oracle.com/technetwork/java/javase/timezones-137583.html
▸ TimeZone management in Android:

https://source.android.com/devices/tech/config/timezone-rules
OTHER THINGS
RESOURCES (II)
▸ Room + Time (zones):

https://medium.com/@chrisbanes/room-time-2b4cf9672b98
▸ US Navy Astronomical Information:

http://aa.usno.navy.mil/faq/index.php
▸ Joda Time

https://www.joda.org/joda-time

https://github.com/JodaOrg/joda-time

https://github.com/dlew/joda-time-android
▸ ThreeTen

https://github.com/ThreeTen/threetenbp

https://github.com/JakeWharton/ThreeTenABP
OTHER THINGS
GET IN TOUCH
Kai Koenig
Email: kai@ventego-creative.co.nz
Work: http://www.ventego-creative.co.nz
Twitter: @AgentK
Telegram: @kaikoenig
Slides: http://www.slideshare.com/agentk

More Related Content

Similar to Why a whole country skipped a day - Fun with Timezones

Rapid analytic development on near real time data
Rapid analytic development on near real time dataRapid analytic development on near real time data
Rapid analytic development on near real time dataAustin Heyne
 
Introducing GNSS/GPS backup as a service (GBaaS)
Introducing GNSS/GPS backup as a service (GBaaS)Introducing GNSS/GPS backup as a service (GBaaS)
Introducing GNSS/GPS backup as a service (GBaaS)ADVA
 
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in Android
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in AndroidIntroducing the Galileo PVT App:from Assisted GNSS to NeQuick model in Android
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in AndroidThe European GNSS Agency (GSA)
 
Case study tilos-brennerbasetunnel 3
Case study tilos-brennerbasetunnel 3Case study tilos-brennerbasetunnel 3
Case study tilos-brennerbasetunnel 3FNDFutureNetworkDeve
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLagamaPasala
 

Similar to Why a whole country skipped a day - Fun with Timezones (8)

Rapid analytic development on near real time data
Rapid analytic development on near real time dataRapid analytic development on near real time data
Rapid analytic development on near real time data
 
Introducing GNSS/GPS backup as a service (GBaaS)
Introducing GNSS/GPS backup as a service (GBaaS)Introducing GNSS/GPS backup as a service (GBaaS)
Introducing GNSS/GPS backup as a service (GBaaS)
 
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in Android
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in AndroidIntroducing the Galileo PVT App:from Assisted GNSS to NeQuick model in Android
Introducing the Galileo PVT App:from Assisted GNSS to NeQuick model in Android
 
Tour10: Time Difference, Elapse Flying Time
Tour10: Time Difference, Elapse Flying TimeTour10: Time Difference, Elapse Flying Time
Tour10: Time Difference, Elapse Flying Time
 
Case study tilos-brennerbasetunnel 3
Case study tilos-brennerbasetunnel 3Case study tilos-brennerbasetunnel 3
Case study tilos-brennerbasetunnel 3
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptx
 
Fun times with ruby
Fun times with rubyFun times with ruby
Fun times with ruby
 
Early warning forecast of an oil spill bp deepwater horizon in the gulf
Early warning forecast of an oil spill bp deepwater horizon in the gulfEarly warning forecast of an oil spill bp deepwater horizon in the gulf
Early warning forecast of an oil spill bp deepwater horizon in the gulf
 

More from Kai Koenig

Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsKai Koenig
 
Android 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsAndroid 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsKai Koenig
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesKai Koenig
 
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKai Koenig
 
Kotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKai Koenig
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code qualityKai Koenig
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampKai Koenig
 
2017: Kotlin - now more than ever
2017: Kotlin - now more than ever2017: Kotlin - now more than ever
2017: Kotlin - now more than everKai Koenig
 
Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Kai Koenig
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinKai Koenig
 
API management with Taffy and API Blueprint
API management with Taffy and API BlueprintAPI management with Taffy and API Blueprint
API management with Taffy and API BlueprintKai Koenig
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinKai Koenig
 
Introduction to Data Mining
Introduction to Data MiningIntroduction to Data Mining
Introduction to Data MiningKai Koenig
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileReal World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileKai Koenig
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friendKai Koenig
 
Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101Kai Koenig
 
There's a time and a place
There's a time and a placeThere's a time and a place
There's a time and a placeKai Koenig
 
Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Kai Koenig
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 

More from Kai Koenig (20)

Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture Components
 
Android 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsAndroid 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other things
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutes
 
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 version
 
Kotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a tree
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code quality
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcamp
 
2017: Kotlin - now more than ever
2017: Kotlin - now more than ever2017: Kotlin - now more than ever
2017: Kotlin - now more than ever
 
Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with Kotlin
 
API management with Taffy and API Blueprint
API management with Taffy and API BlueprintAPI management with Taffy and API Blueprint
API management with Taffy and API Blueprint
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with Kotlin
 
Introduction to Data Mining
Introduction to Data MiningIntroduction to Data Mining
Introduction to Data Mining
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileReal World Lessons in jQuery Mobile
Real World Lessons in jQuery Mobile
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friend
 
Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101
 
There's a time and a place
There's a time and a placeThere's a time and a place
There's a time and a place
 
Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 

Recently uploaded

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

Why a whole country skipped a day - Fun with Timezones

  • 1. WHY A WHOLE COUNTRY SKIPPED A DAY FUN WITH TIMEZONES KAI KOENIG (@AGENTK)
  • 2. HELLO HELLO My name is Kai. Software Architect in the Web and Android space. Stuff I enjoy: Coding in Android, Kotlin, Java & CFML, compilers and parsers, aviation and flying small aircraft, cats and chickens, Nintendo video games of all ages. Twitter: @AgentK
  • 5.
  • 6.
  • 8. Locations Languages Scripts Cultures We live in a large, complex and connected world Times
  • 9. EXAMPLES ▸ Spoken language, written language & scripts, reading direction, translations ▸ Decimal formats, currency symbols ▸ Meaning of colours, symbols, artworks in a cultural context ▸ Time formats & notation, time zones, boundaries, DST SOME CONTEXT
  • 10. TERMINOLOGY ▸ i18n: internationalisation ▸ Designing software in a way so it can be adapted to various languages ▸ l10n: localisation ▸ Adapting software for a certain region, time or language SOME CONTEXT
  • 11. SOME CONTEXT LOCALES ▸ A locale is a set of parameters that defines the user's language, country and any special variant preferences that the user wants to see in their user interface. ▸ A locale identifier consists of at least a language identifier and (usually) a region identifier: ▸ de_DE vs. de_CH ▸ en_AU vs. en_NZ ▸ mi_NZ
  • 12. SOME CONTEXT TWO WORLDS ▸ Up to and including SDK 23: ▸ Limited exposure of ICU functionality in Android SDK ▸ ICU version-equivalent depends on SDK and in some rare cases on OEM. ▸ Suggestion: import ICU4J manually into your project ▸ From SDK 24 onwards: ▸ Subset of ICU4J is included in SDK, less need for additional library for better i18n support.
  • 18. MORE HISTORY ▸ Greenwich Mean Time (GMT) ▸ Started in 1675 as a local solar time ▸ Used by railway companies in the UK from ~1840 with portable chronometers TIME
  • 19. EVEN MORE HISTORY ▸ November 1868: ▸ New Zealand Mean Time was introduced (GMT+11:30) ▸ Between 1860s-1890s: ▸ USA introduced the railroad time with 4 major time zone TIME
  • 20. TIME ON A GLOBAL LEVEL ▸ The Italian mathematician Filopanti suggested a 24hr time zone system centred in Rome (1858). ▸ By ~1900 most of the Earth had standard time zones, not necessarily in brackets of one hour. ▸ Today: Full hour, 1/2 hour and 1/4 hour time zones ▸ Also: politics play a big part TIME
  • 21. Each time zone spans 15 degrees of longitude
  • 22. GMT VS UTC ▸ GMT: Mean solar time at the meridian passing through the Royal Observatory in Greenwich ▸ UTC: Atomic time that includes leap seconds, guaranteed to always be within 0.9 seconds of the original GMT ▸ UTC is also known as Zulu Time ▸ Fun fact: Earth’s rotation is slowing - we’ll need more leap seconds and more often TIME
  • 24. INTERNATIONAL DATE LINE ▸ An imaginary “line” in the Pacific Ocean. ▸ Crossing the IDL: ▸ East to West (North America -> Asia/Oceania): add a day ▸ West to East (Asia/Oceania -> North America): subtract a day ▸ Established in 1884 based on the 180 degrees Meridian TIME
  • 25. THE NEED FOR A TEMPORAL DISCONTINUITY ON THE GLOBE CAN BE DESCRIBED MATHEMATICALLY AS FOLLOWING FROM THE BORSUK-ULAM THEOREM IN DIMENSION 1 
 TIME
  • 26. “IT IS A TOPOLOGICAL FACT THAT THERE DOES NOT EXIST ANY CONTINUOUS, ONE-TO-ONE FUNCTION MAPPING FROM A CIRCLE ONTO AN INTERVAL.” TIME
  • 27.
  • 28. TIME FORMATS ▸ 09:30 UTC would usually be expressed as 09:30Z or 0930Z ▸ 14:45:15 UTC -> 14:45:15Z or 144515Z ▸ Offsets: ▸ +/-03:00 or +/-0300 or +/-03 ▸ Terminology such as MEST, NZDT, BST etc. are made up and not standardised. TIME
  • 30. TIME FORMATS TIME B3819/18 NOTAMR B3791/18 Q) NZZC/QLXXX/IV/NBO/A /000/999/4120S17448E005 A) NZWN B) 1806231919 C) 1806241800 EST E) TWY A1 CL LGT WIP. INSTALLATION OF TEMPO BLUE TWY EDGE LGT. TWY CL LGT AND BLUE TWY EDGE LGT MAY OPR SIMULTANEOUSLY AS TWY LGT IS PROGRESSIVELY REPLACED
  • 31. TIME FORMATS TIME B3819/18 NOTAMR B3791/18 Q) NZZC/QLXXX/IV/NBO/A /000/999/4120S17448E005 A) NZWN B) 1806231919 C) 1806241800 EST E) TWY A1 CL LGT WIP. INSTALLATION OF TEMPO BLUE TWY EDGE LGT. TWY CL LGT AND BLUE TWY EDGE LGT MAY OPR SIMULTANEOUSLY AS TWY LGT IS PROGRESSIVELY REPLACED
  • 32. DAYLIGHT SAVINGS TIME ▸ DST occurs when a country/region decides to wind their clocks forward one hour to make most of the available sunlight. ▸ Might have a local name - Germany: “Sommerzeit” and “Winterzeit” ▸ Northern and Southern Hemisphere usually move in opposite directions. ▸ Lord Howe (an island between AU and NZ) has a DST of +0030 ▸ Some other areas in Australia ignore DST - mainly West Australia and Queensland — too many farmers that don’t want their cattle/sheep to be upset. TIME
  • 33. TIME ZONES IN JVM LAND ▸ TZ Database: IANA Time Zone Database ▸ Set of text files that can be read and used with the right tools. It’s safe to assume you don’t have those tools and don’t care - most of the time. ▸ A JVM comes with a copy of the TZ Database built-in. ▸ It contains historic and current information on timezones for various locations at any time of the year. TIME
  • 34.
  • 35. TIME ZONES IN JVM LAND ▸ It’s important to update your JVM’s timezone database regularly through JVM updates or through manual patching. ▸ Time legislation changes over the years: ▸ DST start/end dates might be adjusted ▸ Political changes at will ▸ Examples: ▸ JRE 6u10- tzdata2008c ▸ JRE 6u191 - tzdata2018c TIME
  • 36. TIME AND ANDROID ▸ As users, we can’t update tzdata ourselves in any easy way: ▸ Usually baked into the ORM’s system image ▸ If one is root, there are some whacky ways to “fix” tzdata ▸ Hardware manufacturer updates… 🤔🙄 ▸ Big changes in 8.1+ - TimeZone updater solution: ▸ Android team creates timezone rules updates ▸ OEMs can deploy them without full system upgrades TIME
  • 37. CODE AND APIS TO AVOID ▸ Don’t use the old, built-in Date and Calendar classes: ▸ java.util.Date ▸ SimpleDateFormatter etc. ▸ NOT thread-safe ▸ Weeeeeeeeird API TIME
  • 38. JODA TIME ▸ Third-party library to fix the problems of the Date/Time APIs pre-Java 8. ▸ Everyone used Joda Time at some point. ▸ Fixes tzdata update issue: ▸ Library releases get updates ▸ Manual patching if needed now ▸ https://www.joda.org/joda-time TIME
  • 39. JODA PROBLEMS ▸ End of life is on the horizon. ▸ Migration to JSR-310 (java.time) is suggested. ▸ Joda Time’s author was heavily involved with that effort. ▸ Android: ▸ Class loading ▸ Large memory footprint ▸ Joda Time Android: https://github.com/dlew/joda-time-android TIME
  • 40. THREETEN BP ▸ JSR-310 is only available for Java 8+. ▸ ThreeTenBP is a back port library of JSR-310 APIs to Java 6 and 7. ▸ Gotchas: ▸ Not actively developed, library is in “bug fix” mode. ▸ Not a JSR-310 implementation, merely an API back port. ▸ https://github.com/ThreeTen/threetenbp ▸ https://github.com/JakeWharton/ThreeTenABP TIME
  • 41. TIME SOME GOOD PRACTICES ▸ If you can: ▸ Everywhere in your backend, store and manage time in UTC ▸ When passing time around between server and client, use UTC ▸ Presentation layer in clients (Android, iOS, Web etc) takes UTC time and applies user’s timezone information, offsets for DST etc to it ▸ SDK 24+: Consider using android.icu.util package from ICU4J library ▸ https://developer.android.com/reference/android/icu/util/package-summary
  • 42. TIME EXCEPTIONS ▸ There are exceptions: ▸ Is it a good idea to store alarm clock values in UTC - or schedulers in general? ▸ What if the user travels and changes timezone? ▸ What if the user’s timezone information is wrong in the first place?
  • 43. TIME ▸ Australian Central Western Time - UTC +0845 ▸ Self-proclaimed timezone by 5 settlements in the desert.
  • 44. TIME ▸ Time zones cross states ▸ Time zones can even cross counties ▸ Worst offenders: ▸ Kentucky ▸ Indiana ▸ Tennessee
  • 45. TIME ▸ Island of Markets Fyr (Baltic Sea) ▸ Possibly the world’s smallest multi- timezone location
  • 48. TIME SAMOA ▸ Samoa skipped 30/12/2011 and moved across the International Date Line.
 
 
 
 
 ▸ Second big change for the country since changing from right-side driving to left-side driving in 2009 ▸ Tokelau followed their move Samoa Mon 9-5 Tue 9-5 Wed 9-5 Thu 9-5 Fri 9-5 Sat 9-5 Sun 9-5 NZ Tue 8-4 Wed 8-4 Thu 8-4 Fri 8-4 Sat 8-4 Sun 8-4 Mon 8-4 AU (Syd) Tue 6-2 Wed 6-2 Thu 6-2 Fri 6-2 Sat 6-2 Sun 6-2 Mon 6-2 Samoa Mon 9-5 Tue 9-5 Wed 9-5 Thu 9-5 Fri 9-5 Sat 9-5 Sun 9-5 NZ Mon 8-4 Tue 8-4 Wed 8-4 Thu 8-4 Fri 8-4 Sat 8-4 Sun 8-4 AU (Syd) Mon 6-2 Tue 6-2 Wed 6-2 Thu 6-2 Fri 6-2 Sat 6-2 Sun 6-2
  • 49.
  • 50. TIME ▸ Kiribati used to split across 2 days ▸ GMT+12 ▸ GMT+13 ▸ GMT-10 ▸ In 1995, the easternmost group of islands moved across the International Date Line and became GMT+14
  • 51. TIME OTHER ODDITIES ▸ Russia changed all their timezones in 2010 and then (partly) again in 2011 - created a huge issue for a lot of the users of one of my clients (Russian/Ukrainian-focussed sites and app). ▸ The International Space Station uses UTC. ▸ Spain should geographically be in the same time zone as the UK. Why aren’t they? ▸ During WW2, Spain’s dictator Franco wanted to align the Spanish time with Nazi- Germany, their ally. ▸ UK was permanently on GMT+2 during WW2 - even though Greenwich is IN THE UK
  • 52. OTHER THINGS AND FINAL THOUGHTS https://www.flickr.com/photos/chrispiascik/4054331891
  • 53.
  • 54. OTHER THINGS (NORTHERN HEMISPHERE) AUTUMN DST CHANGES FALLOUT ▸ 30 September 2018: NZ goes into DST (moves 1 hr East) ▸ 7 October 2018: AU (New South Wales) goes into DST (moves 1 hr East) ▸ 28 October 2018: Germany and UK leave DST (move 1 hr West) - 30/9 30/9 - 7/10 7/10 - 28/10 28/10 - NZ-AU +2 +3 +2 +2 NZ-Europe +10 +11 +11 +12 AU-Europe +8 +8 +9 +10
  • 55.
  • 56. OTHER THINGS RESOURCES (I) ▸ i18n support in Android:
 https://developer.android.com/guide/topics/resources/internationalization ▸ ICU4J versioning:
 https://developer.android.com/guide/topics/resources/internationalization#versioning-nougat ▸ IANA Time Zone Database:
 http://en.wikipedia.org/wiki/Tz_database ▸ Oracle TZ technote: 
 http://www.oracle.com/technetwork/java/javase/timezones-137583.html ▸ TimeZone management in Android:
 https://source.android.com/devices/tech/config/timezone-rules
  • 57. OTHER THINGS RESOURCES (II) ▸ Room + Time (zones):
 https://medium.com/@chrisbanes/room-time-2b4cf9672b98 ▸ US Navy Astronomical Information:
 http://aa.usno.navy.mil/faq/index.php ▸ Joda Time
 https://www.joda.org/joda-time
 https://github.com/JodaOrg/joda-time
 https://github.com/dlew/joda-time-android ▸ ThreeTen
 https://github.com/ThreeTen/threetenbp
 https://github.com/JakeWharton/ThreeTenABP
  • 58. OTHER THINGS GET IN TOUCH Kai Koenig Email: kai@ventego-creative.co.nz Work: http://www.ventego-creative.co.nz Twitter: @AgentK Telegram: @kaikoenig Slides: http://www.slideshare.com/agentk