Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
zircon
Commits
03e14ad7
Commit
03e14ad7
authored
Jan 29, 2015
by
Michael Gray
Browse files
Zircon::Timestamp.
parent
7b29d09d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
9 deletions
+34
-9
lib/Zircon/Context/ZMQ.pm
lib/Zircon/Context/ZMQ.pm
+9
-7
lib/Zircon/Protocol/Serialiser.pm
lib/Zircon/Protocol/Serialiser.pm
+4
-2
lib/Zircon/Timestamp.pm
lib/Zircon/Timestamp.pm
+21
-0
No files found.
lib/Zircon/Context/ZMQ.pm
View file @
03e14ad7
...
...
@@ -9,11 +9,11 @@ use feature 'state';
use
Carp
qw( croak )
;
use
Errno
qw( EAGAIN ENODATA )
;
use
Readonly
;
use
Time::
HiRes
qw( gettimeofday )
;
use
ZMQ::
LibZMQ3
;
use
ZMQ::
Constants
qw(ZMQ_REP ZMQ_REQ ZMQ_LAST_ENDPOINT ZMQ_POLLIN ZMQ_FD ZMQ_DONTWAIT ZMQ_SNDMORE ZMQ_LINGER EFSM)
;
use
Zircon::
Timestamp
;
use
Zircon::Context::ZMQ::
Ctx
;
use
base
'
Zircon::Trace
';
...
...
@@ -238,13 +238,12 @@ sub _process_server_request {
my
$reply
=
$self
->
_request_callback
->
(
$self
->
_request_body
,
$request_header
,
$collision_result
);
$self
->
zircon_trace
("
reply: '%s'
",
$reply
//
'
<undef>
');
my
(
$sec
,
$usec
)
=
gettimeofday
;
my
$timestamp
=
Zircon::
Timestamp
->
timestamp
;
my
$reply_header
=
{
msg_type
=>
'
REPLY
',
request_id
=>
$request_header
->
{
request_id
},
request_attempt
=>
$request_header
->
{
request_attempt
},
clock_sec
=>
$sec
,
clock_usec
=>
$usec
,
%$timestamp
,
};
if
(
my
$e
=
$self
->
_send_two_part
(
$self
->
_zmq_responder
,
$reply_header
,
$reply
//
''))
{
...
...
@@ -291,12 +290,15 @@ sub send {
my
$error
=
'
unset
';
my
$zerr
;
my
(
$sec
,
$usec
)
=
gettimeofday
;
my
$timestamp
=
{};
unless
(
exists
$conn_header
->
{
clock_sec
}
and
exists
$conn_header
->
{
clock_usec
})
{
$timestamp
=
Zircon::
Timestamp
->
timestamp
;
}
my
$header
=
{
%$conn_header
,
%$timestamp
,
msg_type
=>
'
REQUEST
',
clock_sec
=>
$sec
,
clock_usec
=>
$usec
,
};
my
$responder
=
$self
->
_zmq_responder
;
...
...
lib/Zircon/Protocol/Serialiser.pm
View file @
03e14ad7
...
...
@@ -6,7 +6,8 @@ use warnings;
use
Carp
;
use
Scalar::
Util
qw( weaken )
;
use
Time::
HiRes
qw( gettimeofday )
;
use
Zircon::
Timestamp
;
use
Readonly
;
Readonly
my
$ZIRCON_PROTOCOL_VERSION
=>
'
3.0
';
...
...
@@ -133,7 +134,8 @@ sub _timestamp {
my
(
$self
)
=
@_
;
return
if
$self
->
inhibit_timestamps
;
my
(
$sec
,
$usec
)
=
gettimeofday
;
my
$timestamp
=
Zircon::
Timestamp
->
timestamp
;
my
(
$sec
,
$usec
)
=
@$timestamp
{
qw( clock_sec clock_usec )
};
return
('
request_time
'
=>
"
$sec
,
$usec
");
}
...
...
lib/Zircon/Timestamp.pm
0 → 100644
View file @
03e14ad7
package
Zircon::
Timestamp
;
use
strict
;
use
warnings
;
use
Time::
HiRes
qw( gettimeofday )
;
sub
timestamp
{
my
(
$sec
,
$usec
)
=
gettimeofday
;
return
{
clock_sec
=>
$sec
,
clock_usec
=>
$usec
,
};
}
1
;
=
head1
AUTHOR
Ana
Code
B
<
email
>
anacode@sanger
.
ac
.
uk
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment