From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,27d478aa577d0f8b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e16g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Getting current date and time Date: Mon, 23 Jul 2007 14:43:30 -0700 Organization: http://groups.google.com Message-ID: <1185227010.432172.50300@e16g2000pri.googlegroups.com> References: <1185139279.071088.106330@d55g2000hsg.googlegroups.com> <1185145228.126307.301840@d55g2000hsg.googlegroups.com> <1185220676.926492.258330@g4g2000hsf.googlegroups.com> <1185220926.372760.52420@q75g2000hsh.googlegroups.com> <1185221307.073177.279370@n60g2000hse.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185227014 19564 127.0.0.1 (23 Jul 2007 21:43:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Jul 2007 21:43:34 +0000 (UTC) In-Reply-To: <1185221307.073177.279370@n60g2000hse.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: e16g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:16574 Date: 2007-07-23T14:43:30-07:00 List-Id: On Jul 23, 1:08 pm, Maciej Sobczak wrote: > On 23 Lip, 22:02, Maciej Sobczak wrote: > > > I've found it now in the Index - it is described in section 9.6, which > > is not part of the standard library description. > > Still, I don't know how to portably get the number of seconds in the > Unix epoch (for example, now is 1185221230). The built-in Duration > type is not guaranteed to have the necessary range. > How to solve it? In Ada 2005, this is handled by the Differences procedure in Ada.Calendar.Arithmetic (9.6.1). You can use Ada.Calendar.Time_Of to create the Time value for January 1, 1970, and then use that as a parameter to Differences. -- Adam