-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In hindsight they're not really needed. Tweak the examples accordingly. Also improve the README.
- Loading branch information
Showing
3 changed files
with
17 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
package windows | ||
|
||
import ( | ||
"encoding/hex" | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func ExampleFiletime_MarshalBinary() { | ||
ft := NsecToFiletime(1595265310000000000) // time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano() | ||
func ExampleNsecToFiletime() { | ||
ft := NsecToFiletime(time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano()) | ||
|
||
b, err := ft.MarshalBinary() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Print(hex.Dump(b)) | ||
// Output: 00000000 00 a3 7e 52 b9 5e d6 01 |..~R.^..| | ||
fmt.Println(ft) | ||
// Output: {1384030976 30826169} | ||
} | ||
|
||
func ExampleFiletime_UnmarshalBinary() { | ||
ft := new(Filetime) | ||
|
||
if err := ft.UnmarshalBinary([]byte{0x00, 0xa3, 0x7e, 0x52, 0xb9, 0x5e, 0xd6, 0x01}); err != nil { | ||
panic(err) | ||
func ExampleFiletime_Nanoseconds() { | ||
ft := Filetime{ | ||
1384030976, | ||
30826169, | ||
} | ||
|
||
fmt.Println(ft.Nanoseconds()) | ||
// Output: 1595265310000000000 | ||
fmt.Println(time.Unix(0, ft.Nanoseconds()).UTC()) | ||
// Output: 2020-07-20 17:15:10 +0000 UTC | ||
} |