Main Page
Namespaces
Classes
Files
File List
File Members
src
lib
date.cpp
Go to the documentation of this file.
1
8
/*****************************************************************************
9
** Cross Platform Configuration
10
*****************************************************************************/
11
12
#include <ecl/time_lite/config.hpp>
13
14
#if defined(ECL_HAS_POSIX_TIMERS) || defined(ECL_HAS_RT_TIMERS) || defined(ECL_HAS_MACH_TIMERS)
15
16
/*****************************************************************************
17
** Includes
18
*****************************************************************************/
19
20
#include "../../include/ecl/time_lite/date.hpp"
21
#include <ctime>
22
23
/*****************************************************************************
24
** Namespaces
25
*****************************************************************************/
26
27
namespace
ecl
{
28
29
30
std::string get_date_string() {
31
time_t now;
32
char
the_date[12];
33
34
the_date[0] =
'\0'
;
35
now = time(NULL);
36
if
(now != -1)
37
{
38
// this makes use of the variable LC_TIME
39
// it also gives me incorrect time on my machine, wrong time zone?
40
strftime(the_date, 17,
"%Y%m%d-%H%M%S"
, gmtime(&now));
41
}
42
return
std::string(the_date);
43
}
44
45
}
// namespace ecl
46
47
#endif // POSIX_TIMERS || RT_TIMERS
ecl
ecl_time_lite
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:09:07