comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Ada.Calendar.Formatting.Image
Date: Wed, 13 Jun 2007 23:19:08 GMT
Date: 2007-06-13T23:19:08+00:00	[thread overview]
Message-ID: <MX_bi.162376$_c5.16117@attbi_s22> (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



             reply	other threads:[~2007-06-13 23:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 23:19 Jeffrey R. Carter [this message]
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
replies disabled

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