comp.lang.ada
 help / color / mirror / Atom feed
From: awdorrin <awdorrin@gmail.com>
Subject: Re: Ada.Calendar Question
Date: Fri, 20 Jul 2012 11:24:05 -0700 (PDT)
Date: 2012-07-20T11:24:05-07:00	[thread overview]
Message-ID: <c36424fb-3f4b-4ea7-9f52-d48c8de89b29@googlegroups.com> (raw)
In-Reply-To: <6eb75022-3376-400b-bdb5-d0150168f429@googlegroups.com>

I finally realized that these nested packages are tagged private. Now it makes sense.

It looks like the 'easiest' way for me to get from the stored 'seconds' and 'nanoseconds' is to do the following:

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));

  Put_Line( Ada.Calendar.Formatting.Image(
    Date => T, Include_Time_Fraction => True, 
    Time_Zone => Ada.Calendar.Time_Zones.UTC_Time_Offset(T) );

end Example;

The 'To_Duration' is a bit annoying, requiring withing the 'Interfaces.C' package for the 'long' type, but it does work fine.



  reply	other threads:[~2012-07-26 15:05 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 [this message]
2012-07-20 18:51     ` Simon Wright
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