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
270
Updates on MLS on Ruby (and maybe more)
sylph01
1
320
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too (RubyConf Taiwan 2025 ver.)
sylph01
1
190
PicoRuby's Networking is Incomplete
sylph01
1
330
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
1.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
ボードゲーム × 専用収納 〜3Dプリントで埋めるニッチな隙間〜 / Board Games × Custom Storage
handlename
0
390
OpenClawハンズオンでのトラブルとデバイス向けなんちゃらクロー #IoTLT vol133
n0bisuke2
1
310
キャリア科目では教えてくれない、就活を生き抜く法則
logica0419
2
320
JAWS-UG/AWS Community Update
awsjcpm
0
330
Rails 8.1.1 × Claude Code
miyakawa2449
1
130
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
2.1k
파이썬 토룡신점 운영후기
lqez
0
580
AWS/JAWS-UG Community Updates at JAWS-UG Kagoshima
awsjcpm
0
110
ROSAというLLM使ったROSエージェントをおもちゃに実装してみた話
takeofuture
0
330
ライブ感を生む 巻き込み型スライドの作り方/Create your slide like a heavy metal concert
ikuodanaka
5
1.7k
Azure PortalのQoLを上げてたら Big Techに怒られた
horihiro
2
650
多摩.dev で草を食べる話をしたら カンファレンスに登壇していた / from-eating-weeds-to-a-conference
aokiplayer
1
830
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Are puppies a ranking factor?
jonoalderson
2
4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Ruling the World: When Life Gets Gamed
codingconduct
0
380
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
340
Paper Plane
katiecoart
PRO
4
53k
Raft: Consensus for Rubyists
vanstee
142
7.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Automating Front-end Workflow
addyosmani
1369
210k
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?