Skip to content

Commit f60d73b

Browse files
ndokosportante
authored andcommitted
Modify PbenchConfig.timestamp() to return string in proper format
Fixes #1250. The timestamp() method should return a string of the form YYYY-MM-DDThh:mm:ss-TZ It does that for unit tests with a hardcoded string, but for the "real" case, it was returning a timestamp with microseconds added and no TZ. Modify it to use the tstos() function in the latter case. TBD: Change it in the unit test case to return `tstos(0)', i.e. the Unix Epoch date: 1970-01-01T00:00:00-GMT. That will require wholesale changes to the unit test gold files however, so postpone that change for the next release.
1 parent 020a845 commit f60d73b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/lib/pbench/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,14 @@ def get(self, *args, **kwargs):
244244
return self.conf.get(*args, **kwargs)
245245

246246
def timestamp(self):
247+
"""
248+
"Return timestamp formatted as a string of the following form:
249+
<YYYY>-<MM>-<DD>T<hh>:<mm>:<ss>-<TZ>
250+
"""
247251
if self._unittests:
248252
ts = "1900-01-01T00:00:00-UTC"
249253
else:
250-
ts = datetime.utcnow().isoformat()
254+
ts = tstos()
251255
return ts
252256

253257

0 commit comments

Comments
 (0)