Class: Windows::Stat::Structs::WIN32_FIND_DATA

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



112
113
114
115
116
117
118
# File 'lib/win32/file/windows/structs.rb', line 112

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

#ctimeObject

Return the ctime as a number



121
122
123
124
125
126
127
# File 'lib/win32/file/windows/structs.rb', line 121

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

#mtimeObject

Return the mtime as a number



130
131
132
133
134
135
136
# File 'lib/win32/file/windows/structs.rb', line 130

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

#sizeObject

Return the size as a single number



139
140
141
# File 'lib/win32/file/windows/structs.rb', line 139

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