Blame view

src/TimeUtil/TimeUtil.hh 3.21 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * TimeUtil.hh
 *
 *  Created on: 29 oct. 2012
 *      Author: AKKA IS
 */

#ifndef TIMEUTIL_HH_
#define TIMEUTIL_HH_

#include <iostream>
#include <string>
c51d2866   Benjamin Renard   time util
13

fbe3c2bb   Benjamin Renard   First commit
14
15
16
17
18
19
20
21
22
23
24
25
#include "DD_time.hh"

namespace AMDA {

/**
 * @class TimeUtil
 */
class TimeUtil {
	TimeUtil();
	virtual ~TimeUtil();
public:
	static void formatTimeInIso(const double time, std::ostream& pOs, t_DDTimeKind timeKind);
b3096d5d   Hacene SI HADJ MOHAND   correcting time i...
26
27
28
29
30
        
                    static void formatTimeInIsoWithoutMs(const double time, std::ostream& pOs, t_DDTimeKind timeKind);
        
                    static void formatTimeInIsoZ(const double time, std::ostream& pOs, t_DDTimeKind timeKind);
                    
fbe3c2bb   Benjamin Renard   First commit
31
32
33
	static void formatTimeDateInIso(const double time, std::ostream& pOs) {
		formatTimeInIso(time, pOs, DD_TM_DATE);
	}
b3096d5d   Hacene SI HADJ MOHAND   correcting time i...
34
35
36
37
38
39
40
41
        
        	static void formatTimeDateInIsoWithoutMs(const double time, std::ostream& pOs) {
		formatTimeInIsoWithoutMs(time, pOs, DD_TM_DATE);
	}
                
                    static void formatTimeDateInIsoZ(const double time, std::ostream& pOs) {
		formatTimeInIsoZ(time, pOs, DD_TM_DATE);
	}
fbe3c2bb   Benjamin Renard   First commit
42
43
44
45
46
47
48
49
	static void formatTimeIntervalInIso(const double time, std::ostream& pOs) {
		formatTimeInIso(time, pOs, DD_TM_TIME_INTERVAL);
	}

	static std::string formatTimeInIso(const double time, t_DDTimeKind timeKind);
	static std::string formatTimeDateInIso(const double time) {
		return formatTimeInIso(time, DD_TM_DATE);
	}
c51d2866   Benjamin Renard   time util
50
	static void formatTimeDateWithSpaces(const double time , std::ostream& pOs);
fbe3c2bb   Benjamin Renard   First commit
51
52
53
54
55
56
	static std::string formatTimeIntervalInIso(const double time) {
		return formatTimeInIso(time, DD_TM_TIME_INTERVAL);
	}

	static double readTimeInIso(char *stime);

e8595a44   Hacene SI HADJ MOHAND   J'ai corrigĂ© les ...
57
58
59
60
61
62
63
64
65
66
	/**
	 * @brief This static method converts a given time into YYYYDDDHHMMSSMSC and put it into a given std::ostream 
	 * 
	 * @param time given time as double
	 * @param pOs given std::ostream
	 * @param timeKind type of date see DD_Time.hh
	 * @param offsetDay the amount of days to be added to the given time, by default it worths to 0
	 */
	static void double2DD_Time(const double time, std::ostream& pOs, t_DDTimeKind timeKind, const int offsetDay =0 );

fbe3c2bb   Benjamin Renard   First commit
67
68
69
	static void double2DD_TimeDate(const double time, std::ostream& pOs) {
		double2DD_Time(time, pOs, DD_TM_DATE);
	}
e8595a44   Hacene SI HADJ MOHAND   J'ai corrigĂ© les ...
70
71
72
73
74

	static void double2DOY_TimeDate(const double time, std::ostream& pOs) {
		double2DD_Time(time, pOs, DD_TM_DATE, 1);
	}

fbe3c2bb   Benjamin Renard   First commit
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
	static void double2DD_TimeInterval(const double time, std::ostream& pOs){
		double2DD_Time(time, pOs, DD_TM_TIME_INTERVAL);
	}

	static std::string double2DD_Time(const double time, t_DDTimeKind timeKind);
	static std::string double2DD_TimeDate(const double time) {
		return double2DD_Time(time, DD_TM_DATE);
	}
	static std::string double2DD_TimeInterval(const double time){
		return double2DD_Time(time,  DD_TM_TIME_INTERVAL);
	}

	static std::string DD2ISO_Time(std::string time, t_DDTimeKind timeKind );
	static std::string DD2ISO_TimeDate(std::string time) {
		return DD2ISO_Time(time, DD_TM_DATE);
	}
	static std::string DD2ISO_TimeInterval(std::string time) {
		return DD2ISO_Time(time, DD_TM_TIME_INTERVAL);
	}

//	static std::string DD2ISO_IntervalTime(std::string time, t_DDTimeKind timeKind) {
//		return DD2ISO_Time((time , DD_TM_TIME_INTERVAL);
//	}

private:
	static int monthday[2][12];
};

} /* namespace AMDA */
#endif /* TIMEUTIL_HH_ */