Merge remote-tracking branch 'remotes/origin/topic/jsiwek/ascii-timestamp-fix'

* remotes/origin/topic/jsiwek/ascii-timestamp-fix:
  Fix WriterBackend::WriterInfo serialization, reenable ascii start/end tags.
This commit is contained in:
Robin Sommer 2012-07-23 16:36:37 -07:00
commit c2e0949484
5 changed files with 11 additions and 11 deletions

View file

@ -1,4 +1,9 @@
2.0-846 | 2012-07-23 16:36:37 -0700
* Fix WriterBackend::WriterInfo serialization, reenable ascii
start/end tags. (Jon Siwek)
2.0-844 | 2012-07-23 16:20:59 -0700 2.0-844 | 2012-07-23 16:20:59 -0700
* Reworking parts of the internal threading/logging/input APIs for * Reworking parts of the internal threading/logging/input APIs for

View file

@ -1 +1 @@
2.0-844 2.0-846

View file

@ -76,6 +76,7 @@ bool WriterBackend::WriterInfo::Read(SerializationFormat* fmt)
if ( ! (fmt->Read(&tmp_path, "path") && if ( ! (fmt->Read(&tmp_path, "path") &&
fmt->Read(&rotation_base, "rotation_base") && fmt->Read(&rotation_base, "rotation_base") &&
fmt->Read(&rotation_interval, "rotation_interval") && fmt->Read(&rotation_interval, "rotation_interval") &&
fmt->Read(&network_time, "network_time") &&
fmt->Read(&size, "config_size")) ) fmt->Read(&size, "config_size")) )
return false; return false;
@ -105,6 +106,7 @@ bool WriterBackend::WriterInfo::Write(SerializationFormat* fmt) const
if ( ! (fmt->Write(path, "path") && if ( ! (fmt->Write(path, "path") &&
fmt->Write(rotation_base, "rotation_base") && fmt->Write(rotation_base, "rotation_base") &&
fmt->Write(rotation_interval, "rotation_interval") && fmt->Write(rotation_interval, "rotation_interval") &&
fmt->Write(network_time, "network_time") &&
fmt->Write(size, "config_size")) ) fmt->Write(size, "config_size")) )
return false; return false;

View file

@ -81,9 +81,9 @@ public:
*/ */
config_map config; config_map config;
WriterInfo() WriterInfo() : path(0), rotation_interval(0.0), rotation_base(0.0),
network_time(0.0)
{ {
path = 0;
} }
WriterInfo(const WriterInfo& other) WriterInfo(const WriterInfo& other)

View file

@ -416,23 +416,16 @@ string Ascii::LogExt()
string Ascii::Timestamp(double t) string Ascii::Timestamp(double t)
{ {
#if 1
return "2012-01-01-00-00-00";
#else
// Using the version below leads to occasional crashes at least on Mac OS.
// Not sure why, all the function should be thread-safe ...
time_t teatime = time_t(t); time_t teatime = time_t(t);
struct tm tmbuf; struct tm tmbuf;
struct tm* tm = localtime_r(&teatime, &tmbuf); struct tm* tm = localtime_r(&teatime, &tmbuf);
char tmp[128]; char tmp[128];
const char* const date_fmt = "%Y-%m-%d-%H-%M-%S"; const char* const date_fmt = "%Y-%m-%d-%H-%M-%S";
strftime(tmp, sizeof(tmp), date_fmt, tm); strftime(tmp, sizeof(tmp), date_fmt, tm);
return tmp; return tmp;
#endif
} }