Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/winft/time.rb
Overview
Extend Time functionality
Constant Summary collapse
- WINFT_MULTIPLIER =
Multiplier from milliseconds to 100 nanoseconds
10_000_000.0- WINFT_EPOCH =
"01/01/1601"- WINFT_OFFSET =
Date.parse(WINFT_EPOCH).strftime(‘s’).to_i * WIN32FT_MULTIPLIER
> -11644473600 * 10_000_000.0
> -116444736000000000
-116_444_736_000_000_000
Class Method Summary collapse
-
.at_winft(timestamp) ⇒ Time
parse windows FILETIME.
Instance Method Summary collapse
-
#to_winft ⇒ Integer
A Windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D.
Class Method Details
.at_winft(timestamp) ⇒ Time
parse windows FILETIME
38 39 40 |
# File 'lib/winft/time.rb', line 38 def self.at_winft() at((.to_i + WINFT_OFFSET) / WINFT_MULTIPLIER) end |
Instance Method Details
#to_winft ⇒ Integer
A Windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC). Windows uses a file time to record when an application creates, accesses, or writes to a file.
convert Time to windows FILETIME integer
28 29 30 |
# File 'lib/winft/time.rb', line 28 def to_winft ((to_i * WINFT_MULTIPLIER) - WINFT_OFFSET).to_i end |