head 1.2; access; symbols pkgsrc-2026Q1:1.2.0.18 pkgsrc-2026Q1-base:1.2 pkgsrc-2025Q4:1.2.0.16 pkgsrc-2025Q4-base:1.2 pkgsrc-2025Q3:1.2.0.14 pkgsrc-2025Q3-base:1.2 pkgsrc-2025Q2:1.2.0.12 pkgsrc-2025Q2-base:1.2 pkgsrc-2025Q1:1.2.0.10 pkgsrc-2025Q1-base:1.2 pkgsrc-2024Q4:1.2.0.8 pkgsrc-2024Q4-base:1.2 pkgsrc-2024Q3:1.2.0.6 pkgsrc-2024Q3-base:1.2 pkgsrc-2024Q2:1.2.0.4 pkgsrc-2024Q2-base:1.2 pkgsrc-2024Q1:1.2.0.2 pkgsrc-2024Q1-base:1.2 pkgsrc-2023Q4:1.1.0.74 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.72 pkgsrc-2023Q3-base:1.1 pkgsrc-2023Q2:1.1.0.70 pkgsrc-2023Q2-base:1.1 pkgsrc-2023Q1:1.1.0.68 pkgsrc-2023Q1-base:1.1 pkgsrc-2022Q4:1.1.0.66 pkgsrc-2022Q4-base:1.1 pkgsrc-2022Q3:1.1.0.64 pkgsrc-2022Q3-base:1.1 pkgsrc-2022Q2:1.1.0.62 pkgsrc-2022Q2-base:1.1 pkgsrc-2022Q1:1.1.0.60 pkgsrc-2022Q1-base:1.1 pkgsrc-2021Q4:1.1.0.58 pkgsrc-2021Q4-base:1.1 pkgsrc-2021Q3:1.1.0.56 pkgsrc-2021Q3-base:1.1 pkgsrc-2021Q2:1.1.0.54 pkgsrc-2021Q2-base:1.1 pkgsrc-2021Q1:1.1.0.52 pkgsrc-2021Q1-base:1.1 pkgsrc-2020Q4:1.1.0.50 pkgsrc-2020Q4-base:1.1 pkgsrc-2020Q3:1.1.0.48 pkgsrc-2020Q3-base:1.1 pkgsrc-2020Q2:1.1.0.44 pkgsrc-2020Q2-base:1.1 pkgsrc-2020Q1:1.1.0.24 pkgsrc-2020Q1-base:1.1 pkgsrc-2019Q4:1.1.0.46 pkgsrc-2019Q4-base:1.1 pkgsrc-2019Q3:1.1.0.42 pkgsrc-2019Q3-base:1.1 pkgsrc-2019Q2:1.1.0.40 pkgsrc-2019Q2-base:1.1 pkgsrc-2019Q1:1.1.0.38 pkgsrc-2019Q1-base:1.1 pkgsrc-2018Q4:1.1.0.36 pkgsrc-2018Q4-base:1.1 pkgsrc-2018Q3:1.1.0.34 pkgsrc-2018Q3-base:1.1 pkgsrc-2018Q2:1.1.0.32 pkgsrc-2018Q2-base:1.1 pkgsrc-2018Q1:1.1.0.30 pkgsrc-2018Q1-base:1.1 pkgsrc-2017Q4:1.1.0.28 pkgsrc-2017Q4-base:1.1 pkgsrc-2017Q3:1.1.0.26 pkgsrc-2017Q3-base:1.1 pkgsrc-2017Q2:1.1.0.22 pkgsrc-2017Q2-base:1.1 pkgsrc-2017Q1:1.1.0.20 pkgsrc-2017Q1-base:1.1 pkgsrc-2016Q4:1.1.0.18 pkgsrc-2016Q4-base:1.1 pkgsrc-2016Q3:1.1.0.16 pkgsrc-2016Q3-base:1.1 pkgsrc-2016Q2:1.1.0.14 pkgsrc-2016Q2-base:1.1 pkgsrc-2016Q1:1.1.0.12 pkgsrc-2016Q1-base:1.1 pkgsrc-2015Q4:1.1.0.10 pkgsrc-2015Q4-base:1.1 pkgsrc-2015Q3:1.1.0.8 pkgsrc-2015Q3-base:1.1 pkgsrc-2015Q2:1.1.0.6 pkgsrc-2015Q2-base:1.1 pkgsrc-2015Q1:1.1.0.4 pkgsrc-2015Q1-base:1.1 pkgsrc-2014Q4:1.1.0.2 pkgsrc-2014Q4-base:1.1; locks; strict; comment @# @; 1.2 date 2024.03.01.12.23.07; author he; state Exp; branches; next 1.1; commitid g89BvtH9lWA6ds0F; 1.1 date 2014.11.05.22.41.38; author he; state Exp; branches; next ; commitid l0xVsMl4Uzhr23Xx; desc @@ 1.2 log @time/titrax: replace the old perl ' module separator with ::. Newer perl now complains if ' is used as module separator. Bump PKGREVISION. @ text @$NetBSD: patch-weekno.perl,v 1.1 2014/11/05 22:41:38 he Exp $ Fix this so that it uses week numbering according to ISO 8601. Also replace ' with :: for newer perl. --- weekno.perl.orig 1995-10-17 13:44:49.000000000 +0000 +++ weekno.perl @@@@ -1,7 +1,7 @@@@ #!/local/bin/perl # Package for date handling -# Use the PERL std library timelocal - older had his own -require "timelocal.pl"; +# Use the PERL std package Time::Local +use Time::Local; package DATE; # J F M A M J J A S O N D @@@@ -51,21 +51,36 @@@@ sub weekno { sub firstdayfirstweek { -# Return first day of week 1 of any year +# Return the day of the year (0 is Jan 1st) +# for the first day of week 1 of any year. +# +# Quoting strftime(3): +# %V is replaced by the week number of the year (Monday as the first day +# of the week) as a decimal number [01,53]. According to ISO 8601 the +# week containing January 1 is week 1 if it has four or more days in +# the new year, otherwise it is week 53 of the previous year, and the +# next week is week 1. The year is given by the `%G' conversion +# specification. +# +# So this will return a negative value in some cases, i.e. when +# Jan 1st falls on either of Tuesday, Wednesday or Thursday, and +# will be positive (1) or zero for Sunday or Monday respectively. +# local($y) = @@_; local($ret); # Get time of January 1, 0.0.0.0 # Note that DST is never in effect on Jan 1... - local($firsttime) = &main'timelocal(0, 0, 0, 1, 0, $y, 0, 0, 0); + local($firsttime) = &main::timelocal(0, 0, 0, 1, 0, $y, 0, 0, 0); local(@@firstday) = localtime($firsttime); local($wday) = $firstday[6]; - # Rule works for some years.....89 to 92 tested, they all hit branch 2... - if ($wday > 3) { - $ret = 8 - $wday; + # Weekday 4 is Thursday (localtime returns zero-based with Sunday = 0) + if ($wday <= 4) { + $ret = 1 - $wday; # first day of week 1 may be in late December + # The exception is when Jan 1 = Sunday (wday 0) } else { - $ret = 1 - $wday; + $ret = 8 - $wday; # first day of week 1 is in January } - $ret; + return $ret; } sub firstinweek { @@@@ -73,7 +88,7 @@@@ sub firstinweek { # (to avoid DST troubles) local($weekno, $year) = @@_; # 2 hours into this year - local($time) = &main'timelocal(0, 0, 2, 1, 0, $year, 0, 0, 0); + local($time) = &main::timelocal(0, 0, 2, 1, 0, $year, 0, 0, 0); # Add number of days since start of year $time += (($weekno - 1) * 7 + &firstdayfirstweek($year)) * 60 * 60 * 24; $time; @ 1.1 log @Add a patch to weekno.perl so that it uses ISO 8601 week numbering. Remove dependence on timelocal.pl; use Time::Local instead. Rename other patches according to new conventions. Fix pkglint warnings. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-ad,v 1.1 2009/04/16 09:54:45 he Exp $ d4 1 d18 1 a18 1 @@@@ -51,7 +51,21 @@@@ sub weekno { d41 3 a43 2 @@@@ -59,13 +73,14 @@@@ sub firstdayfirstweek { local($firsttime) = &main'timelocal(0, 0, 0, 1, 0, $y, 0, 0, 0); d62 9 @