Back to index

natlog  0.91.0
time.cc
Go to the documentation of this file.
00001 #include "showseconds.ih"
00002 
00003 namespace
00004 {
00005     void insertTime(DateTime::TimeType type, 
00006                     std::ostream &out, std::string const &seconds)
00007     {
00008         
00009         DateTime dt(static_cast<time_t>(A2x(seconds)), type);
00010         ostringstream os;
00011         os << dt;
00012             // E.g., 'Sun Nov 2 13:29:11 2008'
00013             //        01234             56789
00014         out << os.str().substr(4, os.str().length() - 9);
00015     }
00016 }
00017 
00018 void ShowSeconds::rawTime(ostream &out, string const &seconds)
00019 {
00020     out << seconds;
00021 }
00022 
00023 void ShowSeconds::utcTime(ostream &out, string const &seconds)
00024 {
00025     insertTime(DateTime::UTC, out, seconds);
00026 }
00027 
00028 void ShowSeconds::localTime(ostream &out, string const &seconds)
00029 {
00030     insertTime(DateTime::LOCALTIME, out, seconds);
00031 }
00032 
00033