diff options
author | beck <> | 2022-11-09 18:11:45 +0000 |
---|---|---|
committer | beck <> | 2022-11-09 18:11:45 +0000 |
commit | 7a1b9a55578a33a31ff0de239cefb3a1b5a06696 (patch) | |
tree | 23f72e62c184351546d1cc70e2ddde0cc0dcb76b /src/regress/lib | |
parent | 40b0954b5bfd30c0d0d88f039592ea972707eaf1 (diff) | |
download | openbsd-7a1b9a55578a33a31ff0de239cefb3a1b5a06696.tar.gz openbsd-7a1b9a55578a33a31ff0de239cefb3a1b5a06696.tar.bz2 openbsd-7a1b9a55578a33a31ff0de239cefb3a1b5a06696.zip |
Add tests for boundary conditions of struct tm.
Struct tm is limited by it's year being an int.
Diffstat (limited to 'src/regress/lib')
-rw-r--r-- | src/regress/lib/libc/time/time_conversion/timetest.c | 126 |
1 files changed, 125 insertions, 1 deletions
diff --git a/src/regress/lib/libc/time/time_conversion/timetest.c b/src/regress/lib/libc/time/time_conversion/timetest.c index 825315c464..77a7cbe115 100644 --- a/src/regress/lib/libc/time/time_conversion/timetest.c +++ b/src/regress/lib/libc/time/time_conversion/timetest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: timetest.c,v 1.1 2022/11/06 12:57:08 beck Exp $ */ | 1 | /* $OpenBSD: timetest.c,v 1.2 2022/11/09 18:11:45 beck Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
@@ -765,6 +765,130 @@ struct timetest timetests[] = { | |||
765 | }, | 765 | }, |
766 | }, | 766 | }, |
767 | { | 767 | { |
768 | .descr="maxint struct tm", | ||
769 | .timezone="right/America/Edmonton", | ||
770 | .time=67767976204675199, | ||
771 | .local_tm= { | ||
772 | .tm_year=2147481747, | ||
773 | .tm_mon=0, | ||
774 | .tm_mday=31, | ||
775 | .tm_hour=16, | ||
776 | .tm_min=59, | ||
777 | .tm_sec=32, | ||
778 | .tm_wday=4, | ||
779 | .tm_yday=30, | ||
780 | .tm_isdst=0, | ||
781 | .tm_gmtoff=-25200, | ||
782 | .tm_zone="MST" | ||
783 | }, | ||
784 | .gmt_tm= { | ||
785 | .tm_year=2147481747, | ||
786 | .tm_mon=0, | ||
787 | .tm_mday=31, | ||
788 | .tm_hour=23, | ||
789 | .tm_min=59, | ||
790 | .tm_sec=59, | ||
791 | .tm_wday=4, | ||
792 | .tm_yday=30, | ||
793 | .tm_isdst=0, | ||
794 | .tm_gmtoff=0, | ||
795 | .tm_zone="GMT" | ||
796 | }, | ||
797 | }, | ||
798 | { | ||
799 | .descr="minint struct tm", | ||
800 | .timezone="right/America/Edmonton", | ||
801 | .time=-67768038398073601, | ||
802 | .local_tm= { | ||
803 | .tm_year=-2147483578, | ||
804 | .tm_mon=0, | ||
805 | .tm_mday=31, | ||
806 | .tm_hour=16, | ||
807 | .tm_min=26, | ||
808 | .tm_sec=7, | ||
809 | .tm_wday=2, | ||
810 | .tm_yday=30, | ||
811 | .tm_isdst=0, | ||
812 | .tm_gmtoff=-27232, | ||
813 | .tm_zone="LMT" | ||
814 | }, | ||
815 | .gmt_tm= { | ||
816 | .tm_year=-2147483578, | ||
817 | .tm_mon=0, | ||
818 | .tm_mday=31, | ||
819 | .tm_hour=23, | ||
820 | .tm_min=59, | ||
821 | .tm_sec=59, | ||
822 | .tm_wday=2, | ||
823 | .tm_yday=30, | ||
824 | .tm_isdst=0, | ||
825 | .tm_gmtoff=0, | ||
826 | .tm_zone="GMT" | ||
827 | }, | ||
828 | }, | ||
829 | { | ||
830 | .descr="maxint struct tm", | ||
831 | .timezone="right/UTC", | ||
832 | .time=67767976204675199, | ||
833 | .local_tm= { | ||
834 | .tm_year=2147481747, | ||
835 | .tm_mon=0, | ||
836 | .tm_mday=31, | ||
837 | .tm_hour=23, | ||
838 | .tm_min=59, | ||
839 | .tm_sec=32, | ||
840 | .tm_wday=4, | ||
841 | .tm_yday=30, | ||
842 | .tm_isdst=0, | ||
843 | .tm_gmtoff=0, | ||
844 | .tm_zone="UTC" | ||
845 | }, | ||
846 | .gmt_tm= { | ||
847 | .tm_year=2147481747, | ||
848 | .tm_mon=0, | ||
849 | .tm_mday=31, | ||
850 | .tm_hour=23, | ||
851 | .tm_min=59, | ||
852 | .tm_sec=59, | ||
853 | .tm_wday=4, | ||
854 | .tm_yday=30, | ||
855 | .tm_isdst=0, | ||
856 | .tm_gmtoff=0, | ||
857 | .tm_zone="GMT" | ||
858 | }, | ||
859 | }, | ||
860 | { | ||
861 | .descr="minint struct tm", | ||
862 | .timezone="right/UTC", | ||
863 | .time=-67768038398073601, | ||
864 | .local_tm= { | ||
865 | .tm_year=-2147483578, | ||
866 | .tm_mon=0, | ||
867 | .tm_mday=31, | ||
868 | .tm_hour=23, | ||
869 | .tm_min=59, | ||
870 | .tm_sec=59, | ||
871 | .tm_wday=2, | ||
872 | .tm_yday=30, | ||
873 | .tm_isdst=0, | ||
874 | .tm_gmtoff=0, | ||
875 | .tm_zone="UTC" | ||
876 | }, | ||
877 | .gmt_tm= { | ||
878 | .tm_year=-2147483578, | ||
879 | .tm_mon=0, | ||
880 | .tm_mday=31, | ||
881 | .tm_hour=23, | ||
882 | .tm_min=59, | ||
883 | .tm_sec=59, | ||
884 | .tm_wday=2, | ||
885 | .tm_yday=30, | ||
886 | .tm_isdst=0, | ||
887 | .tm_gmtoff=0, | ||
888 | .tm_zone="GMT" | ||
889 | }, | ||
890 | }, | ||
891 | { | ||
768 | .descr="0000", | 892 | .descr="0000", |
769 | .timezone="posix/America/Edmonton", | 893 | .timezone="posix/America/Edmonton", |
770 | .time=-62167219200, | 894 | .time=-62167219200, |