Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
タイムゾーンの†闇†
Search
sylph01
May 25, 2017
How-to & DIY
250
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
タイムゾーンの†闇†
社内のプレゼン大会でしゃべった(10分相当)
sylph01
May 25, 2017
More Decks by sylph01
See All by sylph01
人命を救う技術としてのEnd-to-End暗号化とMessaging Layer Security
sylph01
3
260
Updates on MLS on Ruby (and maybe more)
sylph01
1
310
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too (RubyConf Taiwan 2025 ver.)
sylph01
1
180
PicoRuby's Networking is Incomplete
sylph01
1
320
The Definitive? Guide To Locally Organizing RubyKaigi
sylph01
9
4.2k
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too
sylph01
1
240
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too (JP subtitles)
sylph01
2
1k
Introduction to C Extensions
sylph01
3
320
"Actual" Security in Microcontroller Ruby!?
sylph01
0
260
Other Decks in How-to & DIY
See All in How-to & DIY
あなたは何故コミュニティに参加するのか?
awsjcpm
3
440
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
2.1k
ボードゲーム × 専用収納 〜3Dプリントで埋めるニッチな隙間〜 / Board Games × Custom Storage
handlename
0
370
[JAWS DAYS 2026 | Track B] Local Roots, Global Reach
awsjcpm
0
130
登壇資料を素早く作るための順番
kotomin_m
9
2.3k
Trying "Vibe No-code/Low-code" with MCP #noderedjp
n0bisuke2
0
180
チームパフォーマンスを高めるための2種類のセルフマネジメント / Two Types of Self-Management for Improving Team Performance
iwashi86
4
1k
私の ダイエット トレーナー AIさんから 自己紹介が あります
itsukiisamu
0
160
파이썬 토룡신점 운영후기
lqez
0
580
あなたの知らないGarageBandの世界
cheebow
0
230
JAWS-UG/AWS Community Update
awsjcpm
0
320
JAWS SONIC 2026 オンラインでつながり、オフラインで会おう! - JAWS-UG北陸新幹線で始まった支部とコラボ
pharaohkj
1
330
Featured
See All Featured
Docker and Python
trallard
47
4.2k
We Are The Robots
honzajavorek
0
380
Crafting Experiences
bethany
1
350
BBQ
matthewcrist
89
10k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Agile that works and the tools we love
rasmusluckow
331
22k
My Coaching Mixtape
mlcsv
0
320
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
The World Runs on Bad Software
bkeepers
PRO
72
12k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Transcript
λΠϜκʔϯͷ†ҋ† Ryo Kajiwara, 5/25/2017
None
ࠓճ͘͠ ηΩϡϦςΟͷͰ ͋Γ·ͤΜ
None
݁
ຊ ୯ҰTZͰ Α͔ͬͨͶ
ຊ DSTඇద༻Ͱ Α͔ͬͨͶ
·͋ ͬͯ UTC͑
None
QiitaʹRailsͷλΠϜκʔϯ ͷΛॻ͖·ͨ͠ ཁͱͯ͠ɺRubyͷTimeͱDateͱDateTimeΦϒδΣΫτੜ ࣌ͷڍಈͱλΠϜκʔϯΛอ࣋͢Δ͔Ͳ͏͔͕ͦΕͧΕඍົʹҧ ͍·͢ɻ
QiitaʹRailsͷλΠϜκʔϯ ͷΛॻ͖·ͨ͠ …͕ɺγεςϜ࣌ࠁ͕JSTʁͦΜͳαʔόʔͰproductionಈ͔͢Θ͚ ͋Γ·ͤΜɻ ʢ΄Μͱʹຊࠃ֎ʹҰग़͢ؾ͕ͳͯ͘ຊࠃ֎ʹҰσʔλ Λserve͢Δؾ͕ͳ͚Εߏ͍·ͤΜ͕ʣ
αʔόͬͯUTC • σʔλϕʔεʹอଘ͢Δɺ • ΫΤϦ͢ΔͨΊʹ͏ɺ • ͯ͢UTCͰ͢ɻ • JSTͷn࣌Ҏલ͕ཉ͚͠ΕΫΤϦʹ͏มΛ௨͢ɻ
ؓٳ: UTCͬͯԿͷུ • ӳޠͰCoordinated Universal Time • Α͋͘Δӳޠ͡Όͳུ͍শ͍͍ͩͨϑϥϯεޠʢFIFAͱ͔ FIBAͱ͔FINAͱ͔͋ΕͶʣͰ͕͢ϑϥϯεޠͰTemps universel
coordonné • ͦͷؒΛऔͬͯUTC
͡Ό͋ ԿͰʁ
Daylight Saving Time
Daylight Saving Timeͱ • ՆʹͳΔͱ࣌ܭΛ1࣌ؒޙΖʹͣΒ͠ • ౙʹͳΔͱ࣌ܭΛ1࣌ؒલʹ͢ ʮՈʹؼͬͨ͋ͱ໌Δ͍͕࣌ؒ͘ͳΔʯΛૂ͍ͬͯΔɻ
None
αϚʔλΠϜࡴਓࣄ݅ ΧϦϑΥϧχΞʢඪ४࣌UTC-8ɺՆ࣌ؒUTC-7ʣɺ11݄ͷୈ1 ༵ʹͯ Aʮඃऀͷࢮਪఆ࣌ࠁ01:30ʯ BʮԶͬͯͳ͍ʂԶ01:30ʹ60ϚΠϧΕͨͱ͜Ζʹ͍ͨ ΜͩʂϨγʔτ͕ΞϦόΠΛূ໌ͯ͘͠ΕΔʂʯ
Կ͕͔ʁ DSTద༻ԼͰlocal timeΛ͏ͱʮಉ࣌͡ࠁ͕2ճͬͯ͘Δʯ͠ ͘ʮͬͯ͜ͳ͍࣌ࠁ͕͋Δʯ ͳͷͰ࣌ࠁ͕࿈ଓͯ͠ଘࡏ͢ΔUTCΛج४ʹมͯ͠Ε͍͍ɻ Aʮඃऀͷࢮਪఆ࣌ࠁUTC08:30Ͱ͓લͷϨγʔτ UTC09:30ͳΜ͕ͩͳ͋ɻͦ͏͍͑ߴಓ࿏ͷ੍ݶ65mph ͚ͩͬʁʯ
͋Δ͕DSTద༻͔Ͳ͏͔ ΛΔʹʁ ࠃʹΑΓDSTద༻ͷϙϦγʔ͕ҟͳΔͷͰࣗ໌ͳͰͳ͍ɻ
͋Δ͕DSTద༻͔Ͳ͏͔ ΛΔʹʁ • ຊͰ͢ΒྖԼͷ1948ʙ1951DSTద༻ͩͬͨ • DSTద༻ͰΒΕΔΞϝϦΧհɻΞϦκφभඇద༻ɺͨ ͩ͠ΞϦκφभʹؚ·ΕΔφόϗɾωΠγϣϯͷҬDSTద ༻ʢΞϝϦΧࠃͩͱଞʹϋϫΠDSTඇద༻ʣ • DSTద༻ࠃؒͰʮԿ݄ͷୈԿͷԿ༵ʹ։࢝ɾऴྃʯ͕ҟͳ
ΔʢΠϥϯݻఆͷͰߦ͏ʣ
†ҋ†Λղܾ͢Δ tz database
tz databaseͱ ผ໊IANA Timezone Database, Olson/Eggert database ͋ΔҬͰλΠϜκʔϯ͕ͲͷΑ͏ͳมԽΛḷ͔ͬͨΛه͢Δ σʔλϕʔεɻ ΤϦΞ໊/Ҭ໊(ྫ:Asia/Tokyo,
America/Los_Angeles)ͱ͍ͬͨදه ͰಛఆͷҬͷ࣌ࠁͷมԽΛτϨʔε͢Δɻ
ྫ s1 = {{2017, 5, 25}, {0, 0, 0}} |>
:calendar.datetime_to_gregorian_seconds Tzdata.periods_for_time("Asia/Tokyo", s1, :utc) # [%{from: %{standard: 61589206800, utc: 61589174400, wall: 61589206800}, # std_off: 0, until: %{standard: :max, utc: :max, wall: :max}, utc_off: 32400, # zone_abbr: "JST"}] ࠓͷAsia/TokyoͰવJSTɺUTC offset32400ඵ(+9h)
ྫ s2 = {{1948, 5, 3}, {0, 0, 0}} |>
:calendar.datetime_to_gregorian_seconds Tzdata.periods_for_time("Asia/Tokyo", s2, :utc) # [%{from: %{standard: 61483456800, utc: 61483424400, wall: 61483460400}, # std_off: 3600, # until: %{standard: 61494858000, utc: 61494825600, wall: 61494861600}, # utc_off: 32400, zone_abbr: "JDT"}] JSTͷ19485݄20:00ΑΓՆ࣌ؒద༻ͳͷͰɺUTCͰͷ1948/5/3 0:00Ն࣌ؒద༻ൣғɻJDTͱ͍͏λΠϜκʔϯʂ
ྫ s3 = :calendar.datetime_to_gregorian_seconds({{2017 ,11, 5}, {1, 30, 0}}) Tzdata.periods_for_time("America/Los_Angeles",
s3, :wall) # [%{from: %{standard: 63656503200, utc: 63656532000, wall: 63656506800}, # std_off: 3600, # until: %{standard: 63677062800, utc: 63677091600, wall: 63677066400}, # utc_off: -28800, zone_abbr: "PDT"}, # %{from: %{standard: 63677062800, utc: 63677091600, wall: 63677062800}, # std_off: 0, # until: %{standard: 63687952800, utc: 63687981600, wall: 63687952800}, # utc_off: -28800, zone_abbr: "PST"}] wall clock͕201711݄5 01:30Λࢦ࣌͢ࠁPST 01:30ͱPDT 01:30ͷ2͕ͭ͋Γ͏Δɻ
ྫ s4 = :calendar.datetime_to_gregorian_seconds({{2017, 3, 12}, {2, 30, 0}}) Tzdata.periods_for_time("America/Los_Angeles",
s4, :wall) # [] wall clock͕20173݄12 02:30Λࢦ͢͜ͱͳ͍
Ξοϓσʔτ͕සൟʹ͋Δ 2016ͷ࠷ऴ2016jɺͭ·Γ2016ͷؒͰ10ճߋ৽͕͋ͬ ͨɻ ϙϦγʔͷมԽ͕10ճ͋ͬͨͷͰͳ͘bugfixͱ͔͋Δɻ ੲͷLinuxͰJapan/South Ryukyu IslandsΛࢦ͢ͱUTC+8ʹͳͬͨͱ ͍͏όά͕͋ͬͨɻ͜ΕtzdataʹʮླྀٿॾౡͰUTC+8͕ΘΕ ͍ͯͨʯͱ͍͏ޡใ͕هࡌ͞Ε͍ͯͨͨΊɻ
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ • ErlangElixirͦ͜·Ͱ࣌ࠁม͕ڧ͍Θ͚Ͱͳ͍ • λΠϜκʔϯΛؚΉ࣌ࠁܕElixirʹ͋Δ • Tzdatatz databaseͷAPIΛఏڙ͢ΔͷΈɺ͔͠͠ಉػೳͷ RubyͷϥΠϒϥϦʹൺͯAPI͕গʑ͠ΜͲ͍
• Erlangͷerlang_localtimeAPIΑ͍͕tz databaseߋ৽ͷpull request͕์ஔ͞Ε͍ͯΔ
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ • ݱঢ়ͰʮAPI͕͠ΜͲ͘ͳ͍ʯʮself-updating or maintainedʯΛ ຬͨ͢ͷ͓ͦΒ͘Calendar @ ElixirɻElixir 1.3Ͱಋೖ͞Εͨܕ
ʹλΠϜκʔϯมΛఏڙ͢ΔɻͬͱλΠϜκʔϯಋೖʹ Αͬͯएׯͷ͠ΜͲ͞ಋೖ͞Ε͍ͯΔ
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ iex(3)> Calendar.DateTime.from_erl {{2017, 11, 5}, {8, 30, 0}},
"America/Los_Angeles" {:ok, %DateTime{calendar: Calendar.ISO, day: 5, hour: 8, microsecond: {0, 0}, minute: 30, month: 11, second: 0, std_offset: 0, time_zone: "America/Los_Angeles", utc_offset: -28800, year: 2017, zone_abbr: "PST"}}
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ iex(4)> Calendar.DateTime.from_erl {{2017, 11, 5}, {1, 30, 0}},
"America/Los_Angeles" {:ambiguous, %Calendar.AmbiguousDateTime{possible_date_times: [%DateTime{calendar: Calendar.ISO, day: 5, hour: 1, microsecond: {0, 0}, minute: 30, month: 11, second: 0, std_offset: 3600, time_zone: "America/Los_Angeles", utc_offset: -28800, year: 2017, zone_abbr: "PDT"}, %DateTime{calendar: Calendar.ISO, day: 5, hour: 1, microsecond: {0, 0}, minute: 30, month: 11, second: 0, std_offset: 0, time_zone: "America/Los_Angeles", utc_offset: -28800, year: 2017, zone_abbr: "PST"}]}}
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ iex(5)> Calendar.DateTime.from_erl {{2017, 3, 12}, {2, 30, 0}},
"America/Los_Angeles" {:error, :invalid_datetime_for_timezone}
Erlang/Elixirͷ࣌ࠁϥΠϒϥ Ϧ͕͠ΜͲ͍ • from_erl/1 ͷҾ͕UTCͰͳͦ͘ͷλΠϜκʔϯʹ͓͚Δ wall clockͰ͋Δ͜ͱ໊͕લ͔ΒΓ͍ͨɻͦΓΌͦ͏ͩͱ͍͑ ͦ͏͚ͩͲ… • %Calendar.AmbiguousDateTime
ʹแ·ΕͯΔͷύλʔϯϚ ονͷͨΊͩΖ͏͚Ͳ… ͱ͍͑ݱঢ়ͰҰ൪Ϛγʹݟ͑Δɻ
None
݁
ຊ ୯ҰTZͰ Α͔ͬͨͶ
ຊ DSTඇద༻Ͱ Α͔ͬͨͶ
·͋ ͬͯ UTC͑
Questions?