Back to index

natlog  0.91.0
showseconds.h
Go to the documentation of this file.
00001 #ifndef INCLUDED_SHOWSECONDS_
00002 #define INCLUDED_SHOWSECONDS_
00003 
00004 #include <iosfwd>
00005 #include <ctime>
00006 #include <string>
00007 
00008 class ShowSeconds
00009 {
00010     friend std::ostream &operator<<(std::ostream &out, 
00011                                     ShowSeconds const &showSeconds);
00012 
00013     std::string d_seconds;
00014 
00015     static std::string s_utcMarker;
00016 
00017     static void (*s_show)(std::ostream &out, std::string const &time);
00018 
00019     public:
00020         ShowSeconds(std::string const &seconds);
00021         ShowSeconds(time_t seconds);
00022 
00023         static void setFormat();
00024         static std::string const &utcMarker();
00025 
00026     private:
00027             // all in time.cc
00028         static void rawTime(std::ostream &out, std::string const &seconds);
00029         static void utcTime(std::ostream &out, std::string const &seconds);
00030         static void localTime(std::ostream &out, std::string const &seconds);
00031 };
00032 
00033 inline std::string const &ShowSeconds::utcMarker()
00034 {
00035     return s_utcMarker;
00036 }
00037 
00038 #endif
00039 
00040