Changeset 88e8240 in nscp


Ignore:
Timestamp:
11/10/07 09:37:53 (6 years ago)
Author:
Michael Medin <michael@…>
Children:
d2394a2
Parents:
bf3d4f2
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/strEx.h

    r484be40 r88e8240  
    4242  inline std::string format_date(time_t time, std::string format) { 
    4343    char buf[51]; 
    44     struct tm nt; 
    45     if (gmtime_s(&nt, &time) != 0) 
     44    struct tm *nt = new struct tm; 
     45#if (_MSC_VER < 1300)  // 1300 == VC++ 7.0 
     46    if (gmtime_s(nt, &time) != 0) 
    4647      return ""; 
    47     size_t l = strftime(buf, 50, format.c_str(), &nt); 
     48#else 
     49    nt = gmtime(&time); 
     50    if (nt == NULL) 
     51      return ""; 
     52#endif 
     53    size_t l = strftime(buf, 50, format.c_str(), nt); 
    4854    if (l <= 0 || l >= 50) 
    4955      return ""; 
Note: See TracChangeset for help on using the changeset viewer.