There's a time and a place

1,335 views
1,121 views

Published on

This talk is about time, time zones, locales, translations, regions and all sorts of stuff that is related to it. Full of history and fun fact goodness.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,335
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

There's a time and a place

  1. 1. There’s a time & a place... Mysteries and fun facts around locales and timezones Monday, 14 October 13
  2. 2. Me Monday, 14 October 13
  3. 3. Monday, 14 October 13
  4. 4. Kai Koenig Working with CFML since 1999 Developing for mobile since 2003 Recovering Flex developer being sucked into JS deeper and deeper Recently rediscovered Functional Programming and sometimes enjoy dabbling with formal aspects of computer science bloginblack.de 2ddu.com twitter.com/agentK Monday, 14 October 13
  5. 5. So...what’s this about Monday, 14 October 13
  6. 6. Motivational Speech • • The world is larger than you might think People... ...live in different places, speak and read diffent scripts • Monday, 14 October 13 • ...have and are used to different cultures - those might be significantly different from what one is used to him- or herself
  7. 7. Examples? • Time, Timezones, Boundaries, DST • Text, Languages, Translations, Reading Dir • Cultures: meaning of colours, images, artwork, social context Monday, 14 October 13
  8. 8. i18n,l10n,g11n • i18n - internationalisation • designing software so that it can be adapted to various languages • l10n - localisation • adapting software for region, time, language etc • g11n - globalisation Monday, 14 October 13
  9. 9. I’m fascinated about and interested in i18n Monday, 14 October 13
  10. 10. Timezone research Monday, 14 October 13
  11. 11. What is time and what are timezones? Monday, 14 October 13
  12. 12. History • Before clocks, people marked the time based on the sun. • Later with mechanical clocks: apparent vs mean solar time. • Railroad time - travel and communication made solar time awkward. Monday, 14 October 13
  13. 13. History • Greenwich Mean Time (GMT) - started 1675 as a local solar time • Railway companies started to use GMT with portable chronometers since the 1840s. • Time zones were a compromise. Monday, 14 October 13
  14. 14. History • November 1868: New Zealand Mean Time (GMT+11:30) • Late 1860s/1870s-1900: USA introduce Railroad times, 4 major time zones Monday, 14 October 13
  15. 15. History • Worldwide time zones: Italian mathematician Filopanti suggested a 24hr time zone system centered in Rome (1858) • By ~1900 most of 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 Monday, 14 October 13
  16. 16. 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 old GMT • UTC is known as Zulu time • Fun fact: Earth’s rotation is slowing - we need more leap seconds! Monday, 14 October 13
  17. 17. Each timezone is 15 degrees longitude wide. Monday, 14 October 13
  18. 18. Time formats • 09:30 UTC would usually be 09:30Z or 0930Z • 14:45:15 UTC -> 14:45:15Z or 144515Z • Offsets: • +/-03:00 or +/-0300 or +/-03 • Stuff like MEST, NZDT, BST etc are made up and not standardised. Monday, 14 October 13
  19. 19. Timezones in Java • TZ Database: IANA Time Zone Database (http://en.wikipedia.org/wiki/Tz_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. • A JVM comes with a copy of the TZ Database built-in. Monday, 14 October 13
  20. 20. Timezones in Java • It contains historic and current information on timezones for various locations at any time of the year. • More: http://www.oracle.com/technetwork/ java/javase/timezones-137583.html Monday, 14 October 13
  21. 21. Updating TZ data • It’s important to update your JVM’s timezone database regularly. • Time legislation changes over the years: • DST start/end dates • Political changes • Example: CF 9 shipped with Java 1.6.0_10 --- that’s time zone data from 2008 (v2008c) Monday, 14 October 13
  22. 22. Oddities • Samoa skipped 30/12/2011. Why - any guesses? • While doing that, they also changed from driving on the right-hand side of the road to the left-hand side. • Tokelau copied their move a year later. Monday, 14 October 13
  23. 23. Oddities • Chatham Islands are part of New Zealand. • Timezone is UTC+1275 Monday, 14 October 13
  24. 24. Oddities • Australian Central Western Time - UTC +0845 • Self-proclaimed timezone by 5 settlements in the desert. Monday, 14 October 13
  25. 25. Oddities • • Time zones can even cross counties • Monday, 14 October 13 Time zones cross states Worst offenders: Kentucky & Indiana
  26. 26. Smallest multi-timezone location? • This is the island of Markets Fyr in the Baltic Sea Monday, 14 October 13
  27. 27. Other Oddities • Russia changed all their timezones in 2010 and again in 2011 - created a huge issue for a lot of the users of one of my clients (Russian/Ukrainian-focussed sites). • Fun fact: Railway timetables in Russia are always in Moscow time. Airport data is in local time. • The International Space Station uses UTC. Monday, 14 October 13
  28. 28. Daylight Savings • DST occurs when a country/region decides to wind their clocks forward one hour to make most of the available sunlight. • Lord Howe (AU) has a DST of +0030 • Some other areas in Australia ignore DST mainly West Australia and Queensland --too many farmers. Monday, 14 October 13
  29. 29. Time and CFML/JS • CFML: Use Paul Hastings’ TZ CFC • JS: http://pellepim.bitbucket.org/jstz • The main issue in the JS world is detecting DST properly Monday, 14 October 13
  30. 30. i18n and Unicode • The problem of i18n is reasonably solved – a good part of the solution is Unicode • Joel Spolsky in 2003: “If you are a programmer working in 2003 and you don't know the basics of characters, character sets, encodings, and Unicode, and I catch you, I'm going to punish you by making you peel onions for 6 months in a submarine. I swear I will.” Monday, 14 October 13
  31. 31. Unicode in 1 slide • Concept of “platonic letters”. A is different from a or B, but not from A. • Every platonic letter has a magic number (code point): U+0639 • U+0048 U+0065 U+006C U+006C U +006F Monday, 14 October 13
  32. 32. Encodings in 1 slide • • • • 00 48 00 65 00 6C 00 6C 00 6F • • There are more: UTF-16, UTF-7, UCS-2, UCS-4 Monday, 14 October 13 48 00 65 00 6C 00 6C 00 6F 00 Unicode BOM designator: FE FF or FF FE UTF-8: System to store Unicode in 8 bit bytes (code points 0-127 are identical to US-ASCII), 1-4 octets depending on the platonic letter Important message here: There shouldn’t be any text without encoding information floating around…
  33. 33. Encodings and web • Does that sound familiar? • “I’ve got question marks on your website.” • “Where do those boxes come from?” • How do we work with encodings on the web? <meta http-equiv="Content-Type" content="text/html; charset=utf-8”> Monday, 14 October 13
  34. 34. Encodings & CFML • Railo and ACF support Unicode and UTF-8. But there’s more to it – how about your DB content? • i18n has a larger scope than just CFML !!! Monday, 14 October 13
  35. 35. Encodings & CFML • Best practice: Use UTF-8 encoding • If you have to read non-standard encoded content, use the following: • <cfprocessingdirective pageencoding=“utf-8“> • Unfortunately you’d have to put it on every single page… Monday, 14 October 13
  36. 36. Encodings & CFML • Some more concerns: • Non-default output: <cfcontent type="text/html; charset=iso-8859-1"> • Form/URL-Scope: setEncoding("URL", "utf-8") • Various tags support encoding information: <cffile> etc. Monday, 14 October 13
  37. 37. 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. Usually a locale identifier consists of at least a language identifier and a region identifier. • Java: de_DE, en_AU, en_NZ, de_CH, mi_NZ etc.. Monday, 14 October 13
  38. 38. Locales • Locale “stack”: • The operating system provides a system locale • JVM under the hood picks up the locale of the OS – unless you provide a different locale at start-up of your JVM instance • JVM: -Duser.language=de -Duser.region=DE Monday, 14 October 13
  39. 39. Resource Bundles • Preparing your code for using RBs is a defacto standard approach of implementing locales and building i18n apps. • Creating RB for different locales would be considered to be a l10n task. Monday, 14 October 13
  40. 40. Resource Bundles • …are not much more than POTFs (identified via locales): #RB: testJavaRB.properties Cancel=Cancel Go=Ok #RB: testJavaRB_th_TH.properties Cancel=u0E22u0E01u0E40u0E25u0E34u0E01 Go=u0E44u0E1B Monday, 14 October 13
  41. 41. Resource Bundles in CFML • No need to re-invent the wheel. Paul Hastings (http://www.sustainablegis.com/ things.cfm) has ported a lot of Java-based RB-related solutions over to CFML. • Lots of other i18n- and GIS-related work, too! Monday, 14 October 13
  42. 42. UI considerations Monday, 14 October 13
  43. 43. UI considerations Monday, 14 October 13
  44. 44. Get in touch Twitter: @AgentK Blog: http://bloginblack.de Podcast (2 Developers Down Under): http://2ddu.com About me: http://about.me/agentk Monday, 14 October 13

×