octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #36954] datenum / datevec convert date-time st


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #36954] datenum / datevec convert date-time string incorrectly during hour lost to DST
Date: Sat, 1 Jul 2017 08:49:03 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46

Follow-up Comment #16, bug #36954 (project octave):

Here's some timings (on Win7 64-bit, octave-4.3.0+ as of late May)

I used the following script that I ran twice w. & w/o patch:

t_tot = t_max = 0;
t_min = Inf;
dats = [datenum(2009, 1, 1, 0, 1, 0) : (1/24/6) : datenum(2009, 12, 31, 23,
51, 0)];
for ii=1:100
  tic; datv = datevec (dats); tt = toc;
  t_tot += tt;
  t_min = min (t_min, tt);
  t_max = max (t_max, tt);
endfor
t_avg = t_tot / 100;
t_tot
t_min
t_max
t_avg


Without my patch:
+verbatim-
Run 1:

>> t_tot
t_tot =  1.1781
>> t_min
t_min =  0.011000
>> t_max
t_max =  0.029002
>> t_avg
t_avg =  0.011781

Run 2:

>> t_tot
t_tot =  1.1891
>> t_min
t_min =  0.011000
>> t_max
t_max =  0.032002
>> t_avg
t_avg =  0.011891


... and with the patch:

Run 1:

>> t_tot
t_tot =  1.1771
>> t_min
t_min =  0.011000
>> t_max
t_max =  0.028002
>> t_avg
t_avg =  0.011771

Run 2:

>> t_avg = t_tot / 100;
>> t_tot
t_tot =  1.1981
>> t_min
t_min =  0.011000
>> t_max
t_max =  0.021002
>> t_avg
t_avg =  0.011981


I'd say there's no discernable slowdown.

Just to note, looking in the cod for datevec I see in subfunc
__date_vfmt2sfmt__ already 5 consecutive calls to regexprep and 3 to strrep.
So those two I add can't make that much difference, can they.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36954>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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