Commit 933c73d
committed
windows: fix conversions related to Filetime
Filetime.Nanoseconds() has a major drawback: the returned int64 is too
small to represent Filetime's zero value (January 1, 1601) in terms of
nanoseconds since Epoch (00:00:00 UTC, January 1, 1970); MinInt64 only
dates back to year 1677.
This has real-life implications, e.g., some Windows sub systems
(Perflib, to name one) create registry keys with the last write time
property set to zero. In this case, using Nanoseconds() reports an
underflow-affected value of 2185-07-22T00:34:33.709551+01:00.
This commit clearly marks the well-defined boundaries of Nanoseconds().
It introduces the new Unix() that returns a well-known pair of seconds
and nanoseconds (see other mentions in syscall.go) thus is capable to
cover the full range of Filetime values. Additionally, other conversions
related to Filetime are refactored to use full-range values where
possible, and to reflect boundaries in the docstring where not.
See also golang/go#743351 parent 5e63aa5 commit 933c73d
File tree
3 files changed
+119
-13
lines changed- windows
3 files changed
+119
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
| 743 | + | |
744 | 744 | | |
745 | 745 | | |
746 | 746 | | |
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
777 | | - | |
| 776 | + | |
| 777 | + | |
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
782 | 799 | | |
783 | | - | |
784 | | - | |
785 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
786 | 810 | | |
787 | 811 | | |
788 | 812 | | |
| |||
805 | 829 | | |
806 | 830 | | |
807 | 831 | | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
808 | 846 | | |
809 | 847 | | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
810 | 856 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
818 | 871 | | |
819 | 872 | | |
| 873 | + | |
820 | 874 | | |
821 | 875 | | |
822 | 876 | | |
823 | 877 | | |
| 878 | + | |
824 | 879 | | |
825 | 880 | | |
826 | 881 | | |
| |||
0 commit comments