comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ada.Calendar Question
Date: Fri, 20 Jul 2012 19:51:23 +0100
Date: 2012-07-20T19:51:23+01:00	[thread overview]
Message-ID: <m2r4s6s1uc.fsf@nidhoggr.home> (raw)
In-Reply-To: c36424fb-3f4b-4ea7-9f52-d48c8de89b29@googlegroups.com

awdorrin <awdorrin@gmail.com> writes:

> procedure Example( sec : in Integer; nSec : in Integer) is
>
>   T : Ada.Calendar.Time;
>
> begin
>
>   T := Ada.Calendar.Conversions.To_Ada_Time(0) -- to get epoch
>     + Ada.Calendar.Conversions.To_Duration( long(sec), long(nSec));

It depends what you mean by 'epoch'. If it's 1 Jan 1970 (as for Unix),
then you should be aware that at the change to Ada 05 GNAT changed
representations so that 1 Jan 1970 is no longer stored as 0.

      use type Ada.Calendar.Time;
   begin
      T := Ada.Calendar.Time_Of (Year => 1970, Month => 1, Day => 1)
             + Duration (sec) + Duration (nSec) / 1.0e9;



  reply	other threads:[~2012-07-26 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 17:18 Ada.Calendar Question awdorrin
2012-07-20 17:59 ` Adam Beneschan
2012-07-20 18:24   ` awdorrin
2012-07-20 18:51     ` Simon Wright [this message]
2012-07-23 13:23       ` awdorrin
replies disabled

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