I try to get the timestamps st_atime, st_ctime and st_mtime of a file.
The problem is that the returned timestamps are wrong.
For example the function IFsObjInfo::modificationTime returned the timestamp 140734386631113
If i try to convert the timestamp with datetime.datetime.fromtimestamp(t) i got a ValueError exception "ValueError: timestamp out of range for platform localtime()/gmtime() function"
Is there any bug in the timestamp implementation?
I use Windows 8 64 Bit on the Host and the Guest is a Windows 7 64 Bit OS. I use the latest api version
Code: Select all
from vboxapi import VirtualBoxManager
import time
import os
import datetime
#This is a VirtualBox COM/XPCOM API client, no data needed.
wrapper = VirtualBoxManager(None, None)
#Get the VirtualBox manager
mgr = wrapper.mgr
#Get the global VirtualBox object
vbox = wrapper.vbox
#Getr the constants
vboxConstants = wrapper.constants
mach = vbox.findMachine("ForensicTestVM")
session = mgr.getSessionObject(vbox)
mach.lockMachine(session, vboxConstants.LockType_Shared)
# Acquire the VM's console and guest object
console = session.console
guest = console.guest
guestSession = guest.createSession("Administrator", "Heute0000", "", "vboxshell guest exec")
guestSession.waitFor(1,0)
path = os.path.abspath(r"C:\\bdlog.txt")
obj_info = guestSession.fileQueryInfo(path)
print obj_info.modificationTime
t = obj_info.modificationTime
print datetime.datetime.fromtimestamp(t)
140734386631113
Traceback (most recent call last):
File "E:/Dropbox/Dropbox/Master-Thesis/PycharmProjects/untitled2/test4.py", line 41, in <module>
print datetime.datetime.fromtimestamp(t)
ValueError: timestamp out of range for platform localtime()/gmtime() function