From 860c7e13d31390dc16c2cce813e4887f12e76731 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2019 02:52:04 +0000 Subject: ds: use and export monotonic now() All of our internal timing code should use monotonic clocks for consistency against system clock adjustments. This can be shared by our Daemon and NNTP packages. --- lib/PublicInbox/NNTP.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/PublicInbox/NNTP.pm') diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 107cbe31..0a473e42 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -14,7 +14,7 @@ use PublicInbox::Git; require PublicInbox::EvCleanup; use Email::Simple; use POSIX qw(strftime); -use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); +PublicInbox::DS->import('now'); use Digest::SHA qw(sha1_hex); use Time::Local qw(timegm timelocal); use constant { @@ -25,8 +25,6 @@ use constant { r430 => '430 No article with that message-id', }; -sub now () { clock_gettime(CLOCK_MONOTONIC) }; - my @OVERVIEW = qw(Subject From Date Message-ID References Xref); my $OVERVIEW_FMT = join(":\r\n", @OVERVIEW, qw(Bytes Lines)) . ":\r\n"; my $LIST_HEADERS = join("\r\n", @OVERVIEW, -- cgit v1.2.3-24-ge0c7