Stan  1.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
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

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