date.cpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Cross Platform Configuration
00010 *****************************************************************************/
00011 
00012 #include <ecl/time_lite/config.hpp>
00013 
00014 #if defined(ECL_HAS_POSIX_TIMERS) || defined(ECL_HAS_RT_TIMERS) || defined(ECL_HAS_MACH_TIMERS)
00015 
00016 /*****************************************************************************
00017 ** Includes
00018 *****************************************************************************/
00019 
00020 #include "../../include/ecl/time_lite/date.hpp"
00021 #include <ctime>
00022 
00023 /*****************************************************************************
00024 ** Namespaces
00025 *****************************************************************************/
00026 
00027 namespace ecl {
00028 
00029 
00030 std::string get_date_string() {
00031   time_t now;
00032   char the_date[12];
00033 
00034   the_date[0] = '\0';
00035   now = time(NULL);
00036   if (now != -1)
00037   {
00038     // this makes use of the variable LC_TIME
00039     // it also gives me incorrect time on my machine, wrong time zone?
00040     strftime(the_date, 17, "%Y%m%d-%H%M%S", gmtime(&now));
00041   }
00042   return std::string(the_date);
00043 }
00044 
00045 } // namespace ecl
00046 
00047 #endif // POSIX_TIMERS || RT_TIMERS


ecl_time_lite
Author(s): Daniel Stonier
autogenerated on Thu Jun 16 2016 09:47:18