neoctl: make 'print ids' command display time of TIDs
Currently, the command "neoctl [arguments] print ids" has the following output: last_oid = 0x... last_tid = 0x... last_ptid = ... or backup_tid = 0x... last_tid = 0x... last_ptid = ... depending on whether the cluster is in normal or backup mode. This is extremely unreadable since the admin is often interested in the time that corresponds to each tid. Now the output is: last_oid = 0x... last_tid = 0x... (yyyy-mm-dd hh:mm:ss.ssssss) last_ptid = ... or backup_tid = 0x... (yyyy-mm-dd hh:mm:ss.ssssss) last_tid = 0x... (yyyy-mm-dd hh:mm:ss.ssssss) last_ptid = ... /reviewed-on !2
Showing
... | ... | @@ -81,6 +81,16 @@ def unpackTID(ptid): |
higher.reverse() | ||
return (tuple(higher), lower) | ||
def timeStringFromTID(ptid): | ||
""" | ||
Return a string in the format "yyyy-mm-dd hh:mm:ss.ssssss" from a TID | ||
""" | ||
higher, lower = unpackTID(ptid) | ||
seconds = lower * SECOND_PER_TID_LOW | ||
return '%04d-%02d-%02d %02d:%02d:%09.6f' % (higher[0], higher[1], higher[2], | ||
higher[3], higher[4], seconds) | ||
|
||
def addTID(ptid, offset): | ||
""" | ||
Offset given packed TID. | ||
... | ... |