comp.lang.ada
 help / color / mirror / Atom feed
From: reinkor <reinkor@gmail.com>
Subject: Re: Newbie Q: How to program in UTC (time/calendar) ?
Date: Fri, 27 Mar 2009 05:52:15 -0700 (PDT)
Date: 2009-03-27T05:52:15-07:00	[thread overview]
Message-ID: <7f003dc4-3c3c-4e47-8ddf-d5001b310c17@g38g2000yqd.googlegroups.com> (raw)
In-Reply-To: c7c49ff2-e19c-43a4-b60d-cec7de4a6d91@c9g2000yqm.googlegroups.com

Given the following Ada code:

with Text_IO,Ada.Calendar,Ada.Calendar.Formatting;
use  Text_IO,Ada.Calendar,Ada.Calendar.Formatting;
procedure t1 is

  package Int_Io  is new Text_IO.Integer_Io (Integer);
  use Int_Io;

  Time1 : Time;

begin

   Time1 := Value("1970-01-01 00:00:00");
   Put(Image(Time1));New_Line;
   Put(Image(Ada.Calendar.Time_Of(1970,1,1,Duration(0))));

end t1;

This gives (on my linux computer):

1970-01-01 00:00:00
1969-12-31 23:00:00

The last output line here reflects the fact that Ada takes
"local time" from the computer - and the result would be
different if I wait to run my program till next Monday
(this weekend we change to summer daylight saving time).

I would expect that time zones should be explicite - and this would
help programmers to avoid misstakes (which is an argument for Ada).
I made and error due to this my confusion - am I just to much of a
newbie ?

reinert





  reply	other threads:[~2009-03-27 12:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24  8:51 Newbie Q: How to program in UTC (time/calendar) ? reinkor
2009-03-24  9:18 ` Dmitry A. Kazakov
2009-03-24 10:07 ` Martin
2009-03-24 10:55   ` reinkor
2009-03-24 12:49     ` Martin
2009-03-24 18:53       ` Dirk Heinrichs
2009-03-24 23:59         ` Martin
2009-03-25 10:21           ` reinkor
2009-03-25 15:28             ` tmoran
2009-03-25 21:55               ` sjw
2009-03-26  1:38                 ` tmoran
2009-03-26 20:58                   ` sjw
2009-03-27 12:52                     ` reinkor [this message]
2009-03-27 16:58                       ` Jeffrey R. Carter
2009-03-30 11:27                         ` reinkor
2009-03-30 16:47                           ` Jeffrey R. Carter
2009-03-30 12:37                         ` reinkor
2009-03-30 13:45                           ` John B. Matthews
2009-03-30 16:52                           ` Jeffrey R. Carter
2009-03-30 19:34                             ` reinkor
2009-03-30 19:44                             ` reinkor
2009-04-04  2:22                     ` Brian Gaffney
2009-03-24 11:29 ` Jacob Sparre Andersen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox