comp.lang.ada
 help / color / mirror / Atom feed
* Ada.Calendar.Formatting.Image
@ 2007-06-13 23:19 Jeffrey R. Carter
  2007-06-14  5:33 ` AW: Ada.Calendar.Formatting.Image Grein, Christoph (Fa. ESG)
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey R. Carter @ 2007-06-13 23:19 UTC (permalink / raw)


Here's a little test program:

with Ada.Calendar.Formatting;
with Ada.Text_IO;

procedure Time_Test is
    Time : constant Ada.Calendar.Time := Ada.Calendar.Clock;

    Year    : Positive;
    Month   : Positive;
    Day     : Positive;
    Hour    : Natural;
    Minute  : Natural;
    Second  : Natural;
    Sub_Sec : Duration;
    Seconds : Duration;
begin -- Time_Test
    Ada.Calendar.Split (Date    => Time,
                        Year    => Year,
                        Month   => Month,
                        Day     => Day,
                        Seconds => Seconds);
    Ada.Calendar.Formatting.Split (Seconds    => Seconds,
                                   Hour       => Hour,
                                   Minute     => Minute,
                                   Second     => Second,
                                   Sub_Second => Sub_Sec);
    Ada.Text_IO.Put_Line (Item => Integer'Image (Year)   &
                                  Integer'Image (Month)  &
                                  Integer'Image (Day)    &
                                  Integer'Image (Hour)   &
                                  Integer'Image (Minute) &
                                  Integer'Image (Second) &
                                  Duration'Image (Sub_Sec) );
    Ada.Text_IO.Put_Line (Item => Ada.Calendar.Formatting.Image (Time) );
end Time_Test;

Using GNAT GPL 2007 on a Linux/x86 platform with system time set to MST 
(-0700), this outputs

  2007 6 13 15 46 20 0.415945000
2007-06-13 22:45:57

Is the ~23 sec difference correct, or is this an error in Image?

-- 
Jeff Carter
"Sir Robin the-not-quite-so-brave-as-Sir-Lancelot,
who had nearly fought the Dragon of Angnor,
who nearly stood up to the vicious Chicken of Bristol,
and who had personally wet himself at the
Battle of Badon Hill."
Monty Python & the Holy Grail
68



^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <0367891DA5DA7E408D42A860FA002F448D62CA@sma2901.cr.eurocopter.corp>]

end of thread, other threads:[~2007-06-15  8:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13 23:19 Ada.Calendar.Formatting.Image Jeffrey R. Carter
2007-06-14  5:33 ` AW: Ada.Calendar.Formatting.Image Grein, Christoph (Fa. ESG)
2007-06-14 16:53   ` tmoran
2007-06-15  4:36     ` Jeffrey R. Carter
2007-06-15  5:46       ` AW: " Grein, Christoph (Fa. ESG)
2007-06-15  4:37     ` Grein, Christoph (Fa. ESG)
2007-06-14 21:49   ` Per Sandberg
2007-06-15  4:37   ` Jeffrey R. Carter
     [not found] <0367891DA5DA7E408D42A860FA002F448D62CA@sma2901.cr.eurocopter.corp>
2007-06-15  8:12 ` Grein, Christoph (Fa. ESG)

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