Functions | |
Time | parseTime (const std::string &timeStr) |
Parse the time string and return time. | |
std::string | format (const Time &time, const std::string &afmt, Time::Zone zone) |
Convert time to string according to format. | |
void | format (std::ostream &str, const Time &time, const std::string &afmt, Time::Zone zone) |
Format to standard stream object instead of string, same parametes as for previous method. |
This software was developed for the LUSI project. If you use all or part of it, please give an appropriate acknowledgment.
Time PSTime::TimeFormat::parseTime | ( | const std::string & | timeStr | ) |
Parse the time string and return time.
Accepts the time stamp in format:
TimeParseException |
Definition at line 113 of file TimeFormat.cpp.
References cmp_tm(), dtre(), getNsec(), secre(), and PSTime::TimeUtils::timegm().
Referenced by main(), and PSTime::Time::Time().
std::string PSTime::TimeFormat::format | ( | const Time & | time, | |
const std::string & | afmt, | |||
Time::Zone | zone | |||
) |
Convert time to string according to format.
Following format codes are understood:
d
The day of the month as a decimal number (range 01 to 31). %
.Nf Fractional seconds, will print dot followed by N
digits. f
Equivalent to %.9f F
Equivalent to Y-m-d (the ISO 8601 date format). H
The hour as a decimal number using a 24-hour clock (range 00 to 23). m
The month as a decimal number (range 01 to 12). M
The minute as a decimal number (range 00 to 59). s
The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC. S
The second as a decimal number (range 00 to 60). T
The time in 24-hour notation (H:M:S). Y
The year as a decimal number including the century. z
'Z' if time is printed in UTC zone, or offset from UTC to local time. %%
A literal percent character.
Definition at line 208 of file TimeFormat.cpp.
Referenced by PSTime::Time::asString(), PSTime::Time::asStringCompact(), PSTime::Time::asStringFormat(), constructDataFileRegEx(), psana::PSAna::dataSource(), IData::Dataset::dirName(), and PSTime::operator<<().
void PSTime::TimeFormat::format | ( | std::ostream & | str, | |
const Time & | time, | |||
const std::string & | afmt, | |||
Time::Zone | zone | |||
) |
Format to standard stream object instead of string, same parametes as for previous method.
Definition at line 216 of file TimeFormat.cpp.
References formatNsec(), PSTime::Time::gettm(), PSTime::Time::nsec(), PSTime::Time::sec(), and PSTime::Time::UTC.