-
Notifications
You must be signed in to change notification settings - Fork 3
/
TimeStruct.h
44 lines (41 loc) · 1.27 KB
/
TimeStruct.h
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
/**************************************************
Copyright (C), 2011-2012, RIST OF UESTC.
* FileName : TimeStruct.h
* Author : YLF([email protected])
* Version : v1.0
* Date : 15/08/2012
* Description : GPS中时间转换的头文件
**************************************************/
#ifndef _TIMESTRUCT_H_
#define _TIMESTRUCT_H_
struct Time
{
//int nsec; /*纳秒 - 取值区间为[0,59] */
//int usec; /*微妙 - 取值区间为[0,59] */
//int msec; /*毫秒 - 取值区间为[0,59] */
int sec; /*秒 - 取值区间为[0,59] */
int min; /*分 - 取值区间为[0,59] */
int hour; /*时 - 取值区间为[0,23] */
int day; /*天 - 取值区间为[1,31] */
int mon; /*月 - 取值区间为[1,12] */
int year; /*年 - 取值区间>1980 年*/
int weekID;
int SecInWeek;
};
class TimeSet
{
private:
Time time; //本地时间
public:
~TimeSet();
TimeSet();
TimeSet(Time);
TimeSet(int, int, int, int, int, int);
void SetLocalTime(int, int, int, int, int, int); //设置本地时间,如北京时间
void LocalTime2UTCTime(); //UTC时间
void UTCTime2GPSTime();
void LocalTime2GPSTime();
double UTCTime2MJDTime();
void ShowTime();
};
#endif