Skip to content

Commit

Permalink
Timestamps are now zero-paddedd and marked as UTC ('Zulu').
Browse files Browse the repository at this point in the history
(This was an issue preparing the data for Vieria, Krause, and Pack (2020).)
  • Loading branch information
mrkrause committed Apr 8, 2021
1 parent 47f7ef0 commit 0d2eda1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions systemtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define SYSTEMTIME_H_INCLUDED

#include <sstream>
#include <iomanip>

// We're doing the lazy thing and reading a whole struct in at once.
// This depends critically on having sizeof(SystemTime)==16, so use
Expand All @@ -27,8 +28,11 @@ struct SystemTime {
}

friend std::ostream& operator<<(std::ostream& out, const SystemTime& t) {
out << t.year << '-' << t.month << '-' << t.day << ' '
<< t.hour << ':' << t.minute << ':' << t.second << '.' << t.millisecond;
char old_fill = out.fill('0');
out << std::setw(4) << t.year << '-' << std::setw(2) << t.month << '-' << std::setw(2) << t.day << ' '
<< std::setw(2) << t.hour << ':' << std::setw(2) << t.minute << ':' << std::setw(2) << t.second << '.'
<< std::setw(3) << t.millisecond << 'Z';
out.fill(old_fill);
return out;
}
};
Expand Down

0 comments on commit 0d2eda1

Please sign in to comment.