回答編集履歴
4
std::timespec_get
answer
CHANGED
@@ -11,4 +11,5 @@
|
|
11
11
|
----
|
12
12
|
|
13
13
|
`ftime()` は2038年以降は使い物にならなくなる環境が多く言語的には非標準なので、[`std::chrono::
|
14
|
-
steady_clock`](https://cpprefjp.github.io/reference/chrono/steady_clock.html) とか [`std::timespec_get()` ](https://cpprefjp.github.io/reference/ctime/timespec_get.html)を使うほうが将来性は良いのでは。
|
14
|
+
steady_clock`](https://cpprefjp.github.io/reference/chrono/steady_clock.html) ~~とか [`std::timespec_get()` ](https://cpprefjp.github.io/reference/ctime/timespec_get.html)~~を使うほうが将来性は良いのでは。
|
15
|
+
(追記: `std::timespec_get()` も2038年問題がありました。)
|
3
文言
answer
CHANGED
@@ -10,5 +10,5 @@
|
|
10
10
|
|
11
11
|
----
|
12
12
|
|
13
|
-
言語的には非標準の
|
13
|
+
`ftime()` は2038年以降は使い物にならなくなる環境が多く言語的には非標準なので、[`std::chrono::
|
14
14
|
steady_clock`](https://cpprefjp.github.io/reference/chrono/steady_clock.html) とか [`std::timespec_get()` ](https://cpprefjp.github.io/reference/ctime/timespec_get.html)を使うほうが将来性は良いのでは。
|
2
文言
answer
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
> これは正しい計算なのでしょうか?
|
2
2
|
|
3
|
-
いいえ。
|
4
|
-
|
3
|
+
はい。問題はないと思います。
|
5
4
|
|
5
|
+
コード可読性的には、
|
6
|
+
```c++
|
7
|
+
(end.time + end.millitm * 0.0001) - (start.time - start.millitm * 0.0001);
|
8
|
+
```
|
9
|
+
のほうがちょっと良いかもしれません。
|
10
|
+
|
6
11
|
----
|
7
12
|
|
8
13
|
言語的には非標準の `ftime()` を使うよりは、[`std::chrono::
|
1
文言
answer
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
> これは正しい計算なのでしょうか?
|
2
2
|
|
3
|
-
|
3
|
+
いいえ。
|
4
|
+
(TODO: 後で理由を書く)
|
4
5
|
|
5
6
|
----
|
6
7
|
|
7
|
-
|
8
|
+
言語的には非標準の `ftime()` を使うよりは、[`std::chrono::
|
8
9
|
steady_clock`](https://cpprefjp.github.io/reference/chrono/steady_clock.html) とか [`std::timespec_get()` ](https://cpprefjp.github.io/reference/ctime/timespec_get.html)を使うほうが将来性は良いのでは。
|