Search code examples
pythondatedatetime-formatunix-timestamppepper

Pepper Linux log date format looks meaningless


I have a problem with reading the date value from Pepper robot log. I use Python to fetch the log messages from a remote robot. See an example code:

def onMessage(mess):
    print mess # mess is a dictionary with all known LogMessage information.

def main():
    app = qi.Application(url="tcp://10.0.11.252:9559")
    app.start()
    logmanager = app.session.service("LogManager")
    listener = logmanager.getListener()
    listener.onLogMessage.connect(onMessage)
    app.run()

if __name__ == "__main__":
    main()

Тhis is how one log message looks like:

{
    'category': 'ALMemory',
    'level': 5,
    'source': ':notify:0',
    'location': '7b5400e2-18b1-48e4-1127-g4e6544d0621b:3107',
    'date': 11112334305291,
    'message': 'notifying module: _WholeBodyLooker for datachange for key: ALTracker/ObjectLookAt',
    'id': 5599547,
    'systemDate': 1533208857670649344,
 }

The problem is that I don't know the date value meaning. I didn't find any documentation for this value. When I try to covert 11112334305291 to date the result is not meaningful: Sunday, February 19, 2322 11:31:45.291 PM.

Does anyone have any idea what this might mean?


Solution

  • Most likely nanoseconds since the robot has been on (so in your case, about three hours)- see the qi clock API in the documentation.