PSTime::TimeFormat Namespace Reference

Namespace with utility methods to deal with the presentation of the times/dates. More...


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.


Detailed Description

Namespace with utility methods to deal with the presentation of the times/dates.

This software was developed for the LUSI project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
$Id: TimeFormat.h 1844 2011-05-07 01:51:13Z salnikov $
Author:
Andrei Salnikov


Function Documentation

Time PSTime::TimeFormat::parseTime ( const std::string &  timeStr  ) 

Parse the time string and return time.

Accepts the time stamp in format:

where
Exceptions:
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:

Any unrecognized characters not in the above set are copied to output string intact.

Parameters:
[in] time Time object
[in] afmt Format string
[in] zone Time zone specification

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.


Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7