libtime++: Date and time calculation

◆ example2()

void example2 ( )

Definition at line 71 of file example++.cc.

Referenced by main().

72 {
73  libtime::TRelativeTime timespan;
74  int nsamples(1300);
75 
76  cout << "\n"
77  << "Example 2: Which is the time of the last sample?\n"
78  << "----------\n"
79  << "\n";
80 
81  cout << " We have a time series that starts with a first sample at:\n";
82  std::string startstring("2000/12/20 22:34:53.241");
83  cout << " " << startstring << endl;
84 
85  cout << "\n"
86  << " We create an absolute time for the first sample:\n";
87  libtime::TAbsoluteTime starttime(startstring);
88  cout << " " << string(starttime) << endl;
89 
90  cout << "\n"
91  << " The sampling interval of the time series is:\n";
92  libtime::TRelativeTime interval(0,0,0,10);
93  cout << " " << string(interval) << endl;
94 
95  cout << "\n"
96  << " The total series has " << nsamples << " samples"
97  << " with " << nsamples-1 << " intervals.\n"
98  << " That is a time span of:\n";
99  timespan=interval*(nsamples-1);
100  cout << " " << string(timespan) << endl;
101 
102  cout << "\n"
103  << " Hence the last sample was taken at:\n"
104  << " " << string(starttime+timespan) << endl;
105 
106  cout << " You'd like a more advanced one?\n";
107 
108 }
class to contain relative times
Definition: libtime++.h:201
class to contain absolute times
Definition: libtime++.h:149
Here is the caller graph for this function: