Class: Windows::Stat::Structs::BY_HANDLE_FILE_INFORMATION

Inherits:
FFI::Struct
  • Object
show all
Includes:
Constants
Defined in:
lib/win32/file/windows/structs.rb

Instance Method Summary collapse

Instance Method Details

#atimeObject

Return the atime as a number



66
67
68
69
70
71
# File 'lib/win32/file/windows/structs.rb', line 66

def atime
  date = ULARGE_INTEGER.new
  date[:u][:LowPart] = self[:ftLastAccessTime][:dwLowDateTime]
  date[:u][:HighPart] = self[:ftLastAccessTime][:dwHighDateTime]
  date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
end

#ctimeObject

Return the ctime as a number



74
75
76
77
78
79
# File 'lib/win32/file/windows/structs.rb', line 74

def ctime
  date = ULARGE_INTEGER.new
  date[:u][:LowPart] = self[:ftCreationTime][:dwLowDateTime]
  date[:u][:HighPart] = self[:ftCreationTime][:dwHighDateTime]
  date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
end

#mtimeObject

Return the mtime as a number



82
83
84
85
86
87
# File 'lib/win32/file/windows/structs.rb', line 82

def mtime
  date = ULARGE_INTEGER.new
  date[:u][:LowPart] = self[:ftLastWriteTime][:dwLowDateTime]
  date[:u][:HighPart] = self[:ftLastWriteTime][:dwHighDateTime]
  date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
end

#sizeObject

Return the size as a single number



90
91
92
# File 'lib/win32/file/windows/structs.rb', line 90

def size
  (self[:nFileSizeHigh] * (MAXDWORD + 1)) + self[:nFileSizeLow]
end