CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
test_time.cxx File Reference
#include <string>
#include <iostream>
#include "facilities/Timestamp.h"

Go to the source code of this file.

Functions

int main (int, char **)
 

Function Documentation

◆ main()

int main ( int ,
char **  )

Definition at line 11 of file test_time.cxx.

11 {
14
15
16 try {
17 // Timestamp t_ok("2001-11-10 08:00");
18 // Timestamp t_none("2000-09-08 10:00");
19 long int zero = 0;
20 // long int negValue = -2000;
21 Timestamp unixCreation(zero);
22 // Timestamp gmttest("1970-01-01 00:00");
23 long int aTime = 4000;
24
25 Timestamp aTimestamp(aTime);
27
28 std::cout << "unix creation time is " << unixCreation.getString()
29 << std::endl;
30
31
32 std::cout << "aTimestamp is " << aTimestamp.getString()
33 << std::endl;
34
35 std::cout << "cur time (GMT) is " << cur.getString()
36 << std::endl;
37
38 std::string missionStartString("2001-1-1 00:00");
39
40 Timestamp missionStart(missionStartString);
41
42 std::cout << "Supplied string: " << missionStartString << std::endl;
43 std::cout << "Retrieved: " << missionStart.getString() << std::endl;
44
45 std::string PDTString("2005-4-4 12:25");
46 Timestamp PDTTime(PDTString, 25200);
47
48 std::cout << "Supplied PDT string: " << PDTString << std::endl;
49 std::cout << "Retrieved: " << PDTTime.getString() << std::endl;
50 }
51 catch (const BadTimeInput e) {
52 std::cout << "Exception message: " << e.complaint << std::endl;
53 }
54
55 return 0;
56
57}
const DifNumber zero
std::string getString() const
Return string representation of time, not including nanoseconds;.
Definition Timestamp.cxx:92