[Spice-devel] [spice-streaming-agent PATCH] mjpeg: get_time: fix off-by-0

Victor Toso victortoso at redhat.com
Wed Apr 3 08:33:44 UTC 2019


Hi,

On Sun, Mar 31, 2019 at 09:05:16AM -0400, Frediano Ziglio wrote:
> > Subject: [Spice-devel] [spice-streaming-agent PATCH] mjpeg: get_time: fix off-by-0
> > 
> > Only 9 0's are required
> > 
> > Signed-off-by: Uri Lublin <uril at redhat.com>
> 
> Code is fine, comment I'm not sure about.
> Usually off-by- refers to a difference.
> "'s" is meaning possess or relation while here you want to
> express "zeroes", so could be "0s", not 0's.
> 
> I'll leave the final word to some native English speakers.

Just so this don't get stuck in the mailing list waiting for
rewording, my suggestion would be:

    mjpeg: get_time: fix diff between sec to nsec

    1 second is 10^9 nsec, not 10^10.

Acked-by: Victor Toso <victortoso at redhat.com>

> 
> > ---
> >  src/mjpeg-fallback.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> > index 09f3769..1b263f2 100644
> > --- a/src/mjpeg-fallback.cpp
> > +++ b/src/mjpeg-fallback.cpp
> > @@ -26,7 +26,7 @@ static inline uint64_t get_time()
> >  
> >      clock_gettime(CLOCK_MONOTONIC, &now);
> >  
> > -    return (uint64_t)now.tv_sec * 10000000000u + (uint64_t)now.tv_nsec;
> > +    return (uint64_t)now.tv_sec * 1000000000u + (uint64_t)now.tv_nsec;

With rust we can 1_000_000_000_u64, which is nice ;)

> >  }
> >  
> >  namespace {
> 
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190403/10ce89fb/attachment.sig>


More information about the Spice-devel mailing list