On 2009-02-07 16:47-0800 Alan W. Irwin wrote: > [...]I plan > to run one [test of setfromMJD versus timegm] with much finer spacing.
I did such a test with 10 million calls and it turns out setfromMJD is roughly 4 times faster than timegm. That is, on my 2.4GHz box, the time per call is 200 ns for timegm and 50 ns for setfromMJD. (Nice efficiency, Tony!) Furthermore, the two calls agree exactly with each other for <year>:01-01 00:00:00 for every (Gregorian proleptic calendar) year from -5 million to + 5 million. For my very first test of breakDownMJD, I compared its results with gmtime for 60 million calculations (every second between 2008 and 2010). gmtime and breakDownMJD took roughly 100 ns and 200 ns per call and agreed exactly despite the official insertion of a leap second in the middle of the range. The breakDownMJD efficiency is two times worse than gmtime. I am not deeply concerned with that, but it is possible there is room for substantial improvement there so I will keep my eyes open for anything obvious. I think what is going on with the leap seconds is that gmtime ignores leap seconds all together when it converts time_t values to broken-down time. Certainly, that is what breakDownMJD does, and since the two programmes agree exactly, I think that happens for gmtime as well. I assume the actual leap second insertion on a Linux computer is implemented by simply getting the system time_t to repeat once which gives both a time_t discontinuity and broken-down time discontinuity at the real instant when a leap second is inserted. My next step is to implement forceJulian=-1 (i.e., forced proleptic Gregorian mode regardless of date) for breakDownMJD, and then to compare breakDownMJD with gmtime for forceJulian=-1 over a very wide range of date. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel