teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2019/09/26 11:59

投稿

JanTh1989
JanTh1989

スコア87

title CHANGED
File without changes
body CHANGED
@@ -38,4 +38,8 @@
38
38
  omsec += ndate.Millisecounds;
39
39
 
40
40
  uint64_t diff = nmsec - omsec;
41
- ```
41
+ ```
42
+
43
+ ## 開発環境
44
+ OS:Windows10
45
+ ツール:Visual Studio2010 Professional

1

追記

2019/09/26 11:59

投稿

JanTh1989
JanTh1989

スコア87

title CHANGED
File without changes
body CHANGED
@@ -3,6 +3,7 @@
3
3
  何か円滑に割り出す方法はないでしょうか。
4
4
 
5
5
  ```C++
6
+ // 構造体
6
7
  struct STDATE
7
8
  {
8
9
  uint8_t Year; ///< 年 0~n 1970年+n年
@@ -13,4 +14,28 @@
13
14
  uint8_t Seconds; ///< 秒 0~59
14
15
  uint16_t MilliSeconds; ///< ミリ秒 0~999
15
16
  };
17
+ ```
18
+
19
+ ```C++
20
+ //ミリ秒変換サンプル
21
+ STDATE odate = 先データファイル読み込み;
22
+ STDATE ndate = 後データファイル読み込み;
23
+ uint64_t omsec = 0;
24
+ omsec += odate.Year * 12 * 31 * 24 * 60 * 60 * 1000
25
+ omsec += odate.Month * 31 * 24 * 60 * 60 * 1000
26
+ omsec += odate.Day * 24 * 60 * 60 * 1000
27
+ omsec += odate.Hour * 60 * 60 * 1000
28
+ omsec += odate.Minutes * 60 * 1000
29
+ omsec += odate.secounds * 1000;
30
+ omsec += odate.Millisecounds;
31
+ uint64_t nmsec = 0;
32
+ omsec += ndate.Year * 12 * 31 * 24 * 60 * 60 * 1000
33
+ omsec += ndate.Month * 31 * 24 * 60 * 60 * 1000
34
+ omsec += ndate.Day * 24 * 60 * 60 * 1000
35
+ omsec += ndate.Hour * 60 * 60 * 1000
36
+ omsec += ndate.Minutes * 60 * 1000
37
+ omsec += ndate.secounds * 1000;
38
+ omsec += ndate.Millisecounds;
39
+
40
+ uint64_t diff = nmsec - omsec;
16
41
  ```