Stan  2.10.0
probability, sampling & optimization
util.hpp
Go to the documentation of this file.
1 #ifndef STAN_IO_UTIL_HPP
2 #define STAN_IO_UTIL_HPP
3 
4 #include <string>
5 #include <ctime>
6 
7 namespace stan {
8 
9  namespace io {
10 
18  std::string utc_time_string() {
19  // FIXME: use std::strftime
20 
21  // original with asctime
22  // std::time_t rawtime = time(0);
23  // std::tm *time = gmtime(&rawtime);
24  // return std::string(asctime(time));
25 
26  // new with strfitime
27  time_t rawtime;
28  std::time(&rawtime);
29 
30  char cbuf[80];
31  std::strftime(cbuf, 80, "%a %b %d %Y %H:%M:%S",
32  std::localtime(&rawtime));
33 
34  return std::string(cbuf);
35  }
36 
37  }
38 }
39 
40 #endif
Probability, optimization and sampling library.
std::string utc_time_string()
Return the current coordinated universal time (UTC) as a string.
Definition: util.hpp:18

     [ Stan Home Page ] © 2011–2016, Stan Development Team.