00001 // MAKE THIS A HEADER FILE 00002 00003 00004 /*------------------------------------------------------------------------------ 00005 Name: Timestamp.h 00006 Project: xmlBlaster.org 00007 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00008 Comment: Create unique timestamp 00009 Version: $Id: Timestamp.h 13445 2005-07-15 01:54:35Z ruff $ 00010 ------------------------------------------------------------------------------*/ 00011 00012 #ifndef _UTIL_TIMESTAMP_H 00013 #define _UTIL_TIMESTAMP_H 00014 00015 #include <util/xmlBlasterDef.h> 00016 #include <string> 00017 #include <time.h> 00018 #include <util/thread/ThreadImpl.h> 00019 00020 /* 00021 #if defined(_WINDOWS) 00022 ostream& operator <<(ostream& target, const __int64& x); 00023 #endif 00024 */ 00025 00026 namespace org { namespace xmlBlaster { namespace util { 00027 00048 class Dll_Export TimestampFactory { 00049 00050 friend TimestampFactory& getInstance(); 00051 00052 private: 00053 Timestamp lastTimestamp_; 00054 org::xmlBlaster::util::thread::Mutex getterMutex_; 00055 00060 TimestampFactory(); 00061 TimestampFactory(const TimestampFactory &factory); 00062 TimestampFactory& operator =(const TimestampFactory &factory); 00063 00064 00065 public: 00066 00067 ~TimestampFactory(); 00068 00072 static TimestampFactory& getInstance(); 00073 00078 Timestamp getTimestamp(); 00079 00080 static std::string toXml(Timestamp timestamp, const std::string& extraOffset="", bool literal=false); 00081 00082 static std::string getTimeAsString(Timestamp timestamp); 00083 00084 }; 00085 00086 }}} // namespace 00087 00088 #endif