gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] SiRF gpsmon client mode


From: Hal Murray
Subject: Re: [gpsd-dev] SiRF gpsmon client mode
Date: Thu, 12 Feb 2015 16:26:19 -0800

address@hidden said:
> My personal taste is I hate decimal points moving around... 

> Would %.12s work?

I'm assuming you have converted the numbers to a string which may be too 
long, say with something like snprintf(buf, n, "%d.%09d", sec, nano)

Using python to experiment, I think you need "%12.12s"
>>> print "xx%12sxx" % "0.567890123"
xx 0.567890123xx
>>> print "xx%12sxx" % "1234.567890123"
xx1234.567890123xx
>>> print "xx%.12sxx" % "1234.567890123"
xx1234.5678901xx
>>> print "xx%.12sxx" % "4.567890123"
xx4.567890123xx
>>> print "xx%12.12sxx" % "4.567890123"
xx 4.567890123xx
>>> print "xx%12.12sxx" % "-4.567890123"
xx-4.567890123xx


-- 
These are my opinions.  I hate spam.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]