libtime++: Date and time calculation
hierarchicaltimestring.cc
Go to the documentation of this file.
1 
35 #define TF_HIERARCHICALTIMESTRING_CC_VERSION \
36  "TF_HIERARCHICALTIMESTRING_CC V1.0 "
37 
38 #include <sstream>
39 #include <libtime++.h>
40 
41 namespace libtime {
42 
44 {
45  std::ostringstream oss;
46  oss.width(4);
47  oss.fill('0');
48  oss << this->year() << "/";
49  oss.width(2);
50  oss.fill('0');
51  oss << this->month() << "/";
52  oss.width(2);
53  oss.fill('0');
54  oss << this->day() << "-";
55  oss.width(2);
56  oss.fill('0');
57  oss << this->hour() << ":";
58  oss.width(2);
59  oss.fill('0');
60  oss << this->minute() << ":";
61  oss.width(2);
62  oss.fill('0');
63  oss << this->second() << ".";
64  oss.width(3);
65  oss.fill('0');
66  oss << this->milsec();
67  oss.width(3);
68  oss.fill('0');
69  oss << this->micsec();
70  return(oss.str());
71 }
72 
74 {
75  std::ostringstream oss;
76  oss << this->days() << "-";
77  oss.width(2);
78  oss.fill('0');
79  oss << this->hour() << ":";
80  oss.width(2);
81  oss.fill('0');
82  oss << this->minute() << ":";
83  oss.width(2);
84  oss.fill('0');
85  oss << this->second() << ".";
86  oss.width(3);
87  oss.fill('0');
88  oss << this->milsec();
89  oss.width(3);
90  oss.fill('0');
91  oss << this->micsec();
92  return(oss.str());
93 }
94 
95 } // namespace libtime
96 
97 /* ----- END OF hierarchicaltimestring.cc ----- */
timeint days() const
Definition: libtime++.h:408
timeint year() const
Definition: libtime++.h:337
timeint month() const
Definition: libtime++.h:339
timeint day() const
Definition: libtime++.h:341
timeint milsec() const
Definition: libtime++.h:293
std::string hierarchicalstring() const
timeint micsec() const
Definition: libtime++.h:294
timeint hour() const
Definition: libtime++.h:290
timeint second() const
Definition: libtime++.h:292
timeint minute() const
Definition: libtime++.h:291
std::string hierarchicalstring() const