Re: strptime() fails to recognize negative hours

Sergei Naumov via gnuplot-info <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <[email protected]>
В письме от четверг, 2 апреля 2020 г. 19:34:50 MSK пользователь Hans-Bernhard 
Bröker написал:

> So the sign of the hours field extends over to the minutes and seconds.
> 
> I'll assume (although the documentation doesn't say so) that this was
> meant to work like that.
> 
> > gnuplot> print strptime(myTimeFmt,"-01:-02:03.4")
> > -3723.4
> > gnuplot> print strptime(myTimeFmt,"-01:+02:03.4")
> > -3723.4
> 
> Hmm, so there's no way to flip the minutes back to positive once the
> hours are negative.  That IMHO casts doubt on the whole idea of
> inheriting the sign from one field to the other (not to mention what
> might happen if some devious mind decided to use these fields in reverse
> order, i.e. "%tS:%tM:%tH").

Well, this whole mess comes from the fact that gnuplot, it seems, can not read 
A COLUMN in an arbitrary formatted way. 

There is a substitute for time, i.e. 'timefmt' where this thing with a sign is 
probably a bug and has to be fixed in such a way that it is taken into account 
when it sits only before the %tH. Otherwise, it has no meaning.

But it would be cool to make a formatted reading available:

set xdata format "%tH:%tM:%tS"
set ydata format "%tH:%tM:%tS"
plot 'datafile' using ($1.1+$1.2/60+$1.3/3600):($2.1+$2.2/60+$2.3/3600)

where dotted notation indicates a positional value according to a format 
string.

Thanks,
Sergei







_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.