aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/IMAP/Sync.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index b44f0a6..4a9d431 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -23,7 +23,6 @@ use strict;
use Config::Tiny ();
use IO::Select ();
use List::Util 'first';
-use POSIX 'strftime';
use Socket 'SO_KEEPALIVE';
use Exporter 'import';
@@ -288,6 +287,11 @@ sub new($%) {
# are considered.
$self->{_MODIFIED} = {};
+ if (defined $self->{'logger-fd'} and $self->{'logger-fd'}->fileno != fileno STDERR) {
+ require 'POSIX.pm';
+ require 'Time/HiRes.pm';
+ }
+
# wait for the greeting
my $x = $self->_getline();
$x =~ s/\A\* (OK|PREAUTH) // or $self->panic($x);
@@ -402,7 +406,8 @@ sub logger($@) {
return unless @_ and defined $self->{'logger-fd'};
my $prefix = '';
if ($self->{'logger-fd'}->fileno != fileno STDERR) {
- $prefix = strftime "%b %e %H:%M:%S ", localtime;
+ my ($s, $us) = Time::HiRes::gettimeofday();
+ $prefix = POSIX::strftime("%b %e %H:%M:%S", localtime($s)).".$us ";
}
$prefix .= defined "$self->{name}" ? $self->{name} : '';
$prefix .= "($self->{_SELECTED})" if $self->{_STATE} eq 'SELECTED';