def time_t_to_FILE_TIME(time, filetime): ft = rffi.r_longlong((time + secs_between_epochs) * 10000000) filetime.c_dwHighDateTime = rffi.r_uint(ft >> 32) filetime.c_dwLowDateTime = rffi.r_uint(ft) # masking off high bits
def make_longlong(high, low): return (rffi.r_longlong(high) << 32) + rffi.r_longlong(low)
if name == 'fstat': return win32_fstat_llimpl else: return win32_stat_llimpl #__________________________________________________ # Helper functions for win32 def make_longlong(high, low): return (rffi.r_longlong(high) << 32) + rffi.r_longlong(low) # Seconds between 1.1.1601 and 1.1.1970 secs_between_epochs = rffi.r_longlong(11644473600) def FILE_TIME_to_time_t_nsec(filetime): ft = make_longlong(filetime.c_dwHighDateTime, filetime.c_dwLowDateTime) # FILETIME is in units of 100 nsec nsec = (ft % 10000000) * 100 time = (ft / 10000000) - secs_between_epochs return intmask(time), intmask(nsec) def time_t_to_FILE_TIME(time, filetime): ft = rffi.r_longlong((time + secs_between_epochs) * 10000000) filetime.c_dwHighDateTime = rffi.r_uint(ft >> 32) filetime.c_dwLowDateTime = rffi.r_uint(ft) # masking off high bits
return by_handle_info_to_stat(info) finally: lltype.free(info, flavor='raw') if name == 'fstat': return win32_fstat_llimpl else: return win32_stat_llimpl #__________________________________________________ # Helper functions for win32 def make_longlong(high, low): return (rffi.r_longlong(high) << 32) + rffi.r_longlong(low) # Seconds between 1.1.1601 and 1.1.1970 secs_between_epochs = rffi.r_longlong(11644473600) def FILE_TIME_to_time_t_nsec(filetime): ft = make_longlong(filetime.c_dwHighDateTime, filetime.c_dwLowDateTime) # FILETIME is in units of 100 nsec nsec = (ft % 10000000) * 100 time = (ft / 10000000) - secs_between_epochs return intmask(time), intmask(nsec) def time_t_to_FILE_TIME(time, filetime): ft = rffi.r_longlong((time + secs_between_epochs) * 10000000) filetime.c_dwHighDateTime = rffi.r_uint(ft >> 32) filetime.c_dwLowDateTime = rffi.r_uint(ft) # masking off high bits