From 1627f46fbc75d8d564c566de311f0e62f5b7d4d0 Mon Sep 17 00:00:00 2001 From: Myun2 Date: Tue, 1 May 2012 02:03:11 +0900 Subject: [PATCH] =?utf8?q?unixtime.hpp=20=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast/include/roast/time.hpp | 10 ++++++++++ roast/include/roast/time/time.hpp | 10 ++++++++++ roast/include/roast/time/unixtime.hpp | 18 ++++++++++++++++-- roast/test/roast_test_3rd/roast_test_3rd.vcproj | 2 +- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 roast/include/roast/time.hpp create mode 100644 roast/include/roast/time/time.hpp diff --git a/roast/include/roast/time.hpp b/roast/include/roast/time.hpp new file mode 100644 index 00000000..b55cf0eb --- /dev/null +++ b/roast/include/roast/time.hpp @@ -0,0 +1,10 @@ +// Roast+ License + +/* +*/ +#ifndef __SFJP_ROAST__time_HPP__ +#define __SFJP_ROAST__time_HPP__ + +#include "roast/time/time.hpp" + +#endif//__SFJP_ROAST__time_HPP__ diff --git a/roast/include/roast/time/time.hpp b/roast/include/roast/time/time.hpp new file mode 100644 index 00000000..7f71f5fd --- /dev/null +++ b/roast/include/roast/time/time.hpp @@ -0,0 +1,10 @@ +// Roast+ License +/* + +*/ +#ifndef __SFJP_ROAST__time__time_HPP__ +#define __SFJP_ROAST__time__time_HPP__ + +#include "roast/time/unixtime.hpp" + +#endif//__SFJP_ROAST__time__time_HPP__ \ No newline at end of file diff --git a/roast/include/roast/time/unixtime.hpp b/roast/include/roast/time/unixtime.hpp index 9c1b04ca..11ffeb07 100644 --- a/roast/include/roast/time/unixtime.hpp +++ b/roast/include/roast/time/unixtime.hpp @@ -11,10 +11,24 @@ namespace roast { /////////////////////////////////////////////////////////////// - class datetime + typedef ::time_t unix_time_t, unix_time_type; + + unix_time_type get_unix_time_now(){ + return ::time(NULL); + } + + /////////////////////////////////////////////////////////////// + + class unix_time { + protected: + unix_time_type m_time; public: - datetime(){] + unix_time(){ m_time = get_unix_time_now(); } + unix_time(const unix_time_type& tm) : m_time(tm) {} + + unix_time_type get_time() const { return m_time; } + void set_time(const unix_time_type& tm) { m_time = tm; } }; /////////////////////////////////////////////////////////////// diff --git a/roast/test/roast_test_3rd/roast_test_3rd.vcproj b/roast/test/roast_test_3rd/roast_test_3rd.vcproj index 95484871..d224a3fc 100644 --- a/roast/test/roast_test_3rd/roast_test_3rd.vcproj +++ b/roast/test/roast_test_3rd/roast_test_3rd.vcproj @@ -175,7 +175,7 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > -- 2.11.0