On Aug 17, 2008, at 11:43 PM, Andrew Ross wrote: > > Jerry, > > I'm not quite sure what your latest commit is intended to do? It > certainly doesn't reproduce the C results for me. > > The plplot time functions use 0.0 to represent January 1, 1970. > This is > the usual unix convention for the epoch in C time functions. You have > set xmin to be 0.0 by subtracting 2 identical times from each other, > hence the label you see. Is this really what you see with the C > version > of the example as well?
Yes. x29c labels the first major tic as 1970-01-14 and it is 14 minor tics to the right of the left side of the plot. Three additional labeled tics are at 1970-01-28, 1970-02-11, and 1970-02-25. The tweaks that I made in my latest commit cause the generated PS code from both Ada examples to match that from the C example. Maybe there is something wrong with the C time functions on OS X. > > The C version is complicated because the C time functions are rather > unhelpful when it comes to timezones. The example is designed to be in > UTC (Universal coordinate time). This is the norm for scientific > applications to avoid problems with synchronising measurements made in > different locations. Anyway, the C functions mostly work in the local > time zone. What we want is to turn a time broken down into year, > month, > day, hour, min, sec into a time in seconds since January 1 1970. To > achieve this using POSIX functions you have to set the timezone to be > UTC (by setting the TZ variable and then calling tzset). The call to > mktime (which uses the time in the current time zone) will then assume > time in UTC rather than local time. This is not particularly pretty > and > may not work on Windows platforms (testing appreciated!) > > Is there any way in ada to convert a broken down time (in UTC) into a > time in seconds since Jan 1 1970? From a brief look at the gnat > manuals > it seems that ada time functions are also rather muddled when it comes > to time zones. I have not studied the GNAT manuals or the Ada Reference Manual in detail wrt the time functions. (BTW, there are probably GNAT calendar functions that extend the Ada-specified calendar functions. The function that I am using, Time_Of, is standard Ada and not a GNAT extension.) The method that I am using seems to me to be time-zone agnostic, or rather, assumes the same time zone in all calculations. I think that that should work for this example. There appears to be support for many time functions, including leap seconds, in Ada.Calendar.Time_Zones, http://www.adaic.com/standards/ 05rm/html/RM-9-6-1.html, but since the PLplot example should work assuming that the time zones are the same for all dates, there should be no need to use any of the fancy stuff. Jerry > > Cheers > > Andrew > > On Sat, Aug 16, 2008 at 05:31:15PM -0700, Jerry wrote: >> I have made Ada example 29 once again generate identical PS to C. >> However, I don't understand what is going on in the C example. The >> code sets up the initial time of the plot to be December 1, 2005, but >> the horizontal label on the plot begins on January 1, 1970. >> >> Jerry >> >> >> On Aug 14, 2008, at 11:51 AM, Andrew Ross wrote: >> >>> Ada is not too far off. Currently example 20 is missing (plgriddata >>> not >>> implemented?). There are differences with example 21 (plrandd not >>> implemented) and example 29 (problems with Ada calendar functions >>> - we >>> could just hard code in the time value if required - not a plplot >>> issue.) There is also the open 64-bit issue with example 19. >> >> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel