From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 27E572070D for ; Tue, 13 Dec 2016 03:48:17 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] nntp: avoid useless use of strftime Date: Tue, 13 Dec 2016 03:48:14 +0000 Message-Id: <20161213034815.30324-3-e@80x24.org> In-Reply-To: <20161213034815.30324-1-e@80x24.org> References: <20161213034815.30324-1-e@80x24.org> List-Id: There's no need to use strftime if we'll be converting the date by hand, anyways. --- lib/PublicInbox/NNTP.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index b7143ff..9408ffb 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -250,8 +250,8 @@ sub parse_time ($$;$) { ($YYYY, $MM, $DD) = unpack('A4A2A2', $date); } else { # legacy clients send YYMMDD ($YYYY, $MM, $DD) = unpack('A2A2A2', $date); - if ($YYYY > strftime('%y', @now)) { - my $cur_year = $now[5] + 1900; + my $cur_year = $now[5] + 1900; + if ($YYYY > $cur_year) { $YYYY += int($cur_year / 1000) * 1000 - 100; } } -- EW