Re: server: Use g_get_monotonic_time() to get the time in microseconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Sat, Dec 5, 2015 at 1:07 PM, Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> wrote:
> > Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> > ---
> >  server/main-channel.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/server/main-channel.c b/server/main-channel.c
> > index 25e3868..75fea82 100644
> > --- a/server/main-channel.c
> > +++ b/server/main-channel.c
> > @@ -372,14 +372,12 @@ static void
> > main_channel_marshall_ping(RedChannelClient *rcc,
> >                                         PingPipeItem *item)
> >  {
> >      MainChannelClient *mcc = SPICE_CONTAINEROF(rcc, MainChannelClient,
> >      base);
> > -    struct timespec time_space;
> >      SpiceMsgPing ping;
> >      int size_left = item->size;
> >
> >      red_channel_client_init_send_data(rcc, SPICE_MSG_PING, &item->base);
> >      ping.id = ++(mcc->ping_id);
> > -    clock_gettime(CLOCK_MONOTONIC, &time_space);
> > -    ping.timestamp = time_space.tv_sec * 1000000LL + time_space.tv_nsec /
> > 1000LL;
> > +    ping.timestamp = g_get_monotonic_time();
> >      spice_marshall_msg_ping(m, &ping);
> >
> >      while (size_left > 0) {
> > @@ -934,10 +932,8 @@ static int main_channel_handle_parsed(RedChannelClient
> > *rcc, uint32_t size, uint
> >      case SPICE_MSGC_PONG: {
> >          SpiceMsgPing *ping = (SpiceMsgPing *)message;
> >          uint64_t roundtrip;
> > -        struct timespec ts;
> >
> > -        clock_gettime(CLOCK_MONOTONIC, &ts);
> > -        roundtrip = ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL -
> > ping->timestamp;
> > +        roundtrip = g_get_monotonic_time() - ping->timestamp;
> >
> >          if (ping->id == mcc->net_test_id) {
> >              switch (mcc->net_test_stage) {
> > --
> > 2.6.2
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>

Are we sure about this patch?
The ping message is sent and received to/from client so it seems that
microseconds to nanoseconds change is an ABI change.
Unless the timestamp is just used as raw data looks like invalid to me.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]