/
710.txt
201 lines (144 loc) · 9.86 KB
/
710.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
[1] [DFN[[[日時]]の処理]]は、簡単に見えて難しいものです。
* 表現
[SEE[ データモデルは[[日時データモデル]] ]]
[SEE[ 構文やデータ型は[[日時形式]] ]]
* 演算
[FIG(short list)[ [8] [DFN[[[日時]]の[[演算]]]]
- [[期間計算]]
- [[日暦算]]
- 所属と前後日時の取得
-- [[前日]]、[[今日]]、[[翌日]]
-- [[前週]]、[[今週]]、[[来週]]
-- 直近7日
-- [[前月]]、[[今月]]、[[翌月]]
-- 直近30日
-- [[四半期]]
-- [[半期]]
-- [[昨年]]、[[今年]]、[[来年]]
-- [[月初]]、[[月末]]
-- [[月度]]
-- [[年度]]
- [[日時の比較]]
- [[日時の整列]]
- [[暦の換算]]
-- [[曜日]]
- 一覧の取得
-- [[年]]の一覧
-- [[年]]内の[[月]]の一覧
-- [[月]]内の[[日]]の一覧
- [[月]]の[[カレンダー]]の構成
- [[日時入力]]
- 機械的入力の[[構文解析]]
-- [[日時形式]]
- 文字列化
-- [[日時形式]]
-- [[日時表示]]
]FIG]
* 問題
[6] [[日時]]を[[計算機システム]]等で処理する際には、
様々な問題に注意する必要があります。
[FIG(short list)[ [7] [[日時処理]]の問題
- [[日時のセキュリティー]]
- [[日時のプライバシー]]
- [[日時桁溢れ問題]]
-- [[2000年問題]]
-- [[2038年問題]]
- [[閏年]]
- [[閏秒]]
- [[時刻同期]]
- [[夏時刻]]
-- [[夏時刻システム障害]]
- [[改暦]]
-- [[過去の日時]]
-- [[将来の日時]]
-- [[改元]]
-- [[標準時改正]]
- [[暦の換算]]
- [[西暦和暦誤認バグ]]
- [[暦年週年バグ]]
- [[日時計算ソフトウェアのパフォーマンス問題]]
]FIG]
[25]
[[日時]]という[[系]]の複雑性に起因する問題もあれば、
[[日時]]を実装するためのモデル化の失敗による問題もあります。
[[日時制度]]の改正の実施・適用という社会システム運用の問題もあります。
[[日時]]とは無関係の[[プログラミング]]やシステム開発的な問題がたまたま[[日時処理]]に害を及ぼした場合もあります。
[26]
社会の[[情報化]]の進展に伴って、[[日時処理]]の失敗の影響範囲はますます拡大し、
それ自体が社会問題化するようになりました。
[27]
[[西暦2000年問題]]はその端緒であり、代表例といえます。
その後も[[日時処理]]の問題が起こるたびに、
[[西暦2000年問題]]の再来のような言われ方をしています。
[SEE[ [[西暦2020年問題]], [[西暦2021年問題]], [[西暦2038年問題]], [[令和改元]], [[暦年週年バグ]] ]]
-*-*-
- [18] [CITE@en-us[Apple says Do Not Disturb scheduling is broken until January 8 | Ars Technica]], [TIME[2022-07-10T08:37:17.000Z]] <https://arstechnica.com/gadgets/2013/01/apple-says-do-not-disturb-scheduling-is-broken-until-january-7/?comments=1&start=40#comment-23649245>
(コメント欄2ページ目)
-- [19] [[Korpo]], Jan 3, 2013 8:42 AM
>December was missing in the People app, not "completely nuked" or "lost in Android". It was the People app included with a specific version of Android, and only certain localizations (including English).
>
-If you didn't bother upgrading your phone before December, the date/time on your phone would have gone to December just fine.
-If you tried to set an appointment or schedule something to happen in December, it would work just fine.
-If you set someone's birthday or anniversary or something via the web interface (google.com/contacts) It would sync and show them properly.
-If you tried to set/change someone's birthday or anniversary via the People app on a 4.2.0 Android phone for the three weeks it was broken, and you were using an affected language, you'd have issues. The humanity.
;; [20]
「Android で12月がなくなる不具合があった」
のようなキャッチーだけど雑な情報を流している人に苦言を呈している。
そういうのが広がりがちで真相が見えづらくなるので、詳しい情報[[たすかる]]。
[24] [CITE@en[December month missing in calendar '''['''36958380''']''' - Visible to Public - Issue Tracker]], [TIME[2022-07-10T10:06:42.000Z]] <https://issuetracker.google.com/issues/36958380#c46>
[21] [CITE@en-US[Android 4.2 bug omits December from the People app, makes end-of-year birthdays even less bearable | Engadget]]
([TIME[2022-07-10T09:11:55.000Z]])
<https://www.engadget.com/2012-11-18-android-4-2-bug-omits-december-from-the-people-app.html>
[23] [CITE@en[Google cancels Christmas? Why Android can't remember December | Android | The Guardian]], [TIME[2022-07-10T10:05:30.000Z]] <https://www.theguardian.com/technology/blog/2012/nov/18/android-december-lost-birthday>
[22]
[[クリスマス中止のお知らせ]]は[[草]]
* 実装
[FIG(short list)[ [2] [[日時処理]]の実装
- [CODE[[[Date]]]]
- [CODE[[[DateTime.pm]]]]
- [CODE[[[Time::Piece]]]]
- [[Noda Time]]
- [[XFDLの日時処理]]
- [[XDMの日時処理]]
]FIG]
* 関連
[4] [[日次処理]]はまた違います。
* メモ
[3] [CITE[The Best Of Dates, The Worst Of Dates]], [[Gilbert Healton]], [TIME[2016-02-13 05:20:01 +09:00]] <http://x109.healton.net/y2k/yrexamples.html>
[5] [CITE['''['''tz''']''' Temporal - ECMAScript built-in JS Library for dates/times/timezones/calendars in progress]]
([TIME[2021-03-04T21:11:34.000Z]], [TIME[2021-03-05T01:51:17.570Z]])
<https://mm.icann.org/pipermail/tz/2021-March/029899.html>
[9] [CITE@ja[タイムゾーン呪いの書 (知識編)]], [TIME[2021-07-07T00:54:22.000Z]] <https://zenn.dev/dmikurube/articles/curse-of-timezones-common-ja>
[10] [CITE@en[COCOA v1.4.0 が起動しない · Issue #517 · cocoa-mhlw/cocoa · GitHub]], [TIME[2021-11-30T09:48:11.000Z]] <https://github.com/cocoa-mhlw/cocoa/issues/517#issuecomment-978988403>
> [CODE[DateTime()]]は[CODE[0001/01/01 0:00:00]]で、そこからさらに9時間を引こうとしているので怒られている。
> DateTime.MinValueと同値であれば引かないようにとか考えたけど、DateTime.MinValueと同値ではない[CODE[0001/01/01 0:08:00]]から9時間引こうとするとやっぱり落ちるよねと。
[FIG(quote)[
[FIGCAPTION[
[11] [CITE@ja[DateTime.MinValue や new DateTime() は危険 - Cube Lilac]]
([[clown]], [TIME[2021-11-30T09:53:39.000Z]])
<https://clown.cube-soft.jp/entry/2021/11/26/datetime-trap>
]FIGCAPTION]
> 例えば、DateTime.MinValue.ToUniversalTime() は、予想に反して、例外を発生させずに正常終了します(日時の値は変更されずにタイムゾーンの値のみ UTC になる)。ただ、DataContractJsonSerializer の事例のようにライブラリ側で変換処理が実行されて例外が発生する事も多いため、万全を期すのであればライブラリに指定する全ての DateTime オブジェクトに対して ToUniversalTime 等を実施しなければならず、結構な負担となります。
]FIG]
[12] [CITE@ja[606さんはTwitterを使っています 「Dropboxがおかしくて、毎回、関ヶ原終わりたてホヤホヤの頃のExcelファイルが出土されます 巻物でやれ https://t.co/hCLpKXDfde」 / Twitter]]
([TIME[2022-01-20T08:18:34.000Z]], [TIME[2022-01-21T01:39:14.102Z]])
<https://twitter.com/bumWings/status/1483989654378405888>
[13] [CITE@ja-jp[日付と時刻のデータ型および関数 - SQL Server (Transact-SQL) | Microsoft Docs]], [[markingmyname]], [TIME[2022-04-22T09:07:51.000Z]] <https://docs.microsoft.com/ja-jp/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql?view=sql-server-ver15>
-
[14]
[CITE[時間情報を取り扱うための課題の整理を試みる―日本史資料を題材に―]],
[[後藤真]]
-- [15]
[CITE[第25回「東洋学へのコンピュータ利用」研究セミナー]], [TIME[2014-03-15T00:43:49.000Z]], [TIME[2022-04-28T08:52:42.771Z]] <http://kanji.zinbun.kyoto-u.ac.jp/seminars/oricom/2014.html>
-- [16]
[CITE@ja[第25回「東洋学へのコンピュータ利用」研究セミナー(#zinbun #jinbun) (2ページ目) - Togetter]], [TIME[2022-04-28T08:52:51.000Z]] <https://togetter.com/li/642076?page=2>
[17]
[TIME[2022-06-04T13:26:14.200Z]]
<http://www.libraryjournal.com.cn/EN/article/downloadArticleFile.do?attachType=PDF&id=2289>
[28] [CITE@ja[programming and calendar]], [TIME[2022-07-13T08:22:44.000Z]], [TIME[2004-02-03T18:31:26.408Z]] <https://web.archive.org/web/20040203182933/http://www.funaba.org/en/programming-and-calendar.html>
[29] [CITE@ja-JP[Supported Presto and TD Functions - Product Documentation - Treasure Data Product Documentation]], [TIME[2022-08-25T00:18:23.000Z]] <https://docs.treasuredata.com/display/public/PD/Supported+Presto+and+TD+Functions>
[30] [CITE@ja-jp[datetimeV2 作成済みエンティティ - LUIS - Azure Cognitive Services | Microsoft Learn]], [[aahill]], [TIME[2023-01-01T08:22:55.000Z]] <https://learn.microsoft.com/ja-jp/azure/cognitive-services/luis/luis-reference-prebuilt-datetimev2?tabs=1-1%2C2-1%2C3-1%2C4-1%2C5-1%2C6-1>
[32] [CITE[How to save datetimes for future events - (when UTC is not the right answer)]], [TIME[2021-03-03T04:39:21.000Z]], [TIME[2023-06-06T14:30:41.050Z]] <http://www.creativedeletion.com/2015/03/19/persisting_future_datetimes.html>
[31] [CITE@en[Storing UTC is not a silver bullet | Jon Skeet's coding blog]], [TIME[2023-06-06T14:18:20.000Z]], [TIME[2023-06-06T14:30:17.380Z]] <https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/>
[33] [CITE@en[JRS - Critical and Significant Dates - J R Stockton]], [TIME[2023-06-06T14:35:19.000Z]], [TIME[2015-09-08T00:59:13.478Z]] <https://web.archive.org/web/20150908004245/http://www.merlyn.demon.co.uk/critdate.htm>
[34] [CITE@en[ruby/lib/time.rb at master · ruby/ruby · GitHub]], [TIME[2023-09-11T03:54:55.000Z]] <https://github.com/ruby/ruby/blob/master/lib/time.rb>