Rev | Line | |
---|
[4] | 1 | /**
|
---|
| 2 | * @file util.h
|
---|
| 3 | * @author myusgun@gmail.com
|
---|
| 4 | * @brief util
|
---|
| 5 | */
|
---|
| 6 | #ifndef __util_h__
|
---|
| 7 | #define __util_h__
|
---|
| 8 |
|
---|
| 9 | #include "cf/exception.h"
|
---|
| 10 |
|
---|
| 11 | namespace cf
|
---|
| 12 | {
|
---|
| 13 | /**
|
---|
| 14 | * util
|
---|
| 15 | */
|
---|
| 16 | class util
|
---|
| 17 | {
|
---|
| 18 | public:
|
---|
| 19 | /** date/time/week */
|
---|
| 20 | typedef struct datetime
|
---|
| 21 | {
|
---|
| 22 | cf::int32_t mYear; /**< year */
|
---|
| 23 | cf::int32_t mMonth; /**< month */
|
---|
| 24 | cf::int32_t mDay; /**< day */
|
---|
| 25 | cf::int32_t mWeek; /**< weekday (0:SUN ~ 6:SAT) */
|
---|
| 26 | std::string mWeekName; /**< string representation of weekday (SUN ~ SAT) */
|
---|
| 27 |
|
---|
| 28 | cf::int32_t mHour; /**< hour */
|
---|
| 29 | cf::int32_t mMin; /**< minute */
|
---|
| 30 | cf::int32_t mSec; /**< second */
|
---|
| 31 | cf::int32_t mUsec; /**< micro second */
|
---|
| 32 | } datetime;
|
---|
| 33 |
|
---|
| 34 | public:
|
---|
| 35 | /**
|
---|
| 36 | * get instance
|
---|
| 37 | * @return instance
|
---|
| 38 | */
|
---|
| 39 | static util * getInstance();
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * get current time
|
---|
| 43 | * @return datetime structure
|
---|
| 44 | * @throw cf::exception
|
---|
| 45 | * @see struct datetime
|
---|
| 46 | */
|
---|
| 47 | datetime getDateTime() const
|
---|
| 48 | throw (cf::exception);
|
---|
| 49 |
|
---|
| 50 | /**
|
---|
| 51 | * get current timestamp
|
---|
| 52 | * @return time_t
|
---|
| 53 | */
|
---|
| 54 | cf::int64_t getTimeStamp() const;
|
---|
| 55 | };
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | #endif // #ifndef __util_h__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.