winft 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/winft/time.rb +17 -2
- data/lib/winft/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7587890349044c6c244693995b81163d532355f4e03aaaf3b05520fbe41084e
|
|
4
|
+
data.tar.gz: e75f74592b615badfa7933e52c6a74d386becfb6bdf8ba30e0101ff369750f33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c6abc3a284f0b495b23e35950f00db90c53432702f8fdf08034a6e407edb697b6df413dd8c48e0acd2f2c60e0b45c702bfd6fecac97919d1d0f3a242cf2738
|
|
7
|
+
data.tar.gz: 75f37dbecebb3cd809dbf47e45cd5d7dad826ac39ba4e6dbe504d19d5377d0f3cf836bd040b63e834c09254cae283395ab1e3b3faff21fae9226d16960887587
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Winft stands for Windows FILETIME or Windows NT FILETIME or Win32 FILETIME.
|
|
4
4
|
|
|
5
|
-
This is a miniscule gem with only one goal (currently): to extend the Ruby core Time class's methods with `at_winft`.
|
|
5
|
+
This is a miniscule gem with only one goal (currently): to extend the Ruby core Time class's methods with `at_winft`. This is similar to the `Time::at` method which recieves as input an integer which is the number of seconds since the UNIX epoch (Jan. 1st, 1970). The `at_winft` method is different in two ways: 1.) it can receive both an Integer or String, and 2.) it's argument must be the number of 100-nanosecond intervals since Jan. 1st 1601.
|
|
6
6
|
|
|
7
7
|
This can be useful when working with file timestamps that originated from a Windows system, for instance working with Microsoft Active Directory attributes.
|
|
8
8
|
|
|
@@ -40,4 +40,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
40
40
|
|
|
41
41
|
## Code of Conduct
|
|
42
42
|
|
|
43
|
-
Everyone interacting in the Winft project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
43
|
+
Everyone interacting in the Winft project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jvon1904/winft/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/winft/time.rb
CHANGED
|
@@ -11,15 +11,30 @@ class Time
|
|
|
11
11
|
# => -116444736000000000
|
|
12
12
|
WINFT_OFFSET = -116_444_736_000_000_000
|
|
13
13
|
|
|
14
|
-
# parse windows FILETIME
|
|
15
|
-
#
|
|
16
14
|
# A Windows file time is a 64-bit value that represents
|
|
17
15
|
# the number of 100-nanosecond intervals that have elapsed
|
|
18
16
|
# since 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).
|
|
19
17
|
# Windows uses a file time to record when an application creates, accesses, or writes to a file.
|
|
20
18
|
#
|
|
19
|
+
# convert Time to windows FILETIME integer
|
|
20
|
+
#
|
|
21
|
+
# @return [Integer] the number of 100-nanosecond intervals since Windows epoch.
|
|
22
|
+
# @example Convert Time to WINFT
|
|
23
|
+
# now = Time.now #=> 2025-08-18 08:49:51.671107 -0400
|
|
24
|
+
# now.to_winft #=> 133999949910000000
|
|
25
|
+
#
|
|
26
|
+
# # And to convert it back...
|
|
27
|
+
# Time.at_winft(133999949910000000) #=> 2025-08-18 08:49:51 -0400
|
|
28
|
+
def to_winft
|
|
29
|
+
((to_i * WINFT_MULTIPLIER) - WINFT_OFFSET).to_i
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# parse windows FILETIME
|
|
33
|
+
#
|
|
21
34
|
# @param timestamp [String | Integer] the number of 100-nanosecond intervals since Windows epoch.
|
|
22
35
|
# @return [Time] the corresponding local time.
|
|
36
|
+
# @example Convert WINFT to Time
|
|
37
|
+
# Time.at_winft(133999948130000000) #=> 2025-08-18 08:46:53 -0400
|
|
23
38
|
def self.at_winft(timestamp)
|
|
24
39
|
at((timestamp.to_i + WINFT_OFFSET) / WINFT_MULTIPLIER)
|
|
25
40
|
end
|
data/lib/winft/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: winft
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jesse vonBergen
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Extends Ruby's Time class for parsing Windows FILETIME formats
|
|
14
13
|
email:
|
|
@@ -34,7 +33,6 @@ metadata:
|
|
|
34
33
|
rubygems_mfa_required: 'true'
|
|
35
34
|
homepage_uri: https://github.com/jvon1904/winft
|
|
36
35
|
source_code_uri: https://github.com/jvon1904/winft
|
|
37
|
-
post_install_message:
|
|
38
36
|
rdoc_options: []
|
|
39
37
|
require_paths:
|
|
40
38
|
- lib
|
|
@@ -49,8 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
49
47
|
- !ruby/object:Gem::Version
|
|
50
48
|
version: '0'
|
|
51
49
|
requirements: []
|
|
52
|
-
rubygems_version: 3.
|
|
53
|
-
signing_key:
|
|
50
|
+
rubygems_version: 3.6.9
|
|
54
51
|
specification_version: 4
|
|
55
52
|
summary: Extends Ruby's Time class for parsing Windows FILETIME formats
|
|
56
53
|
test_files: []
|