Re: ada calendar

From: Nick Roberts (nick.roberts_at_acm.org)
Date: 12/06/03

  • Next message: tmoran_at_acm.org: "Re: ada calendar"
    Date: Sat, 06 Dec 2003 00:11:26 +0000
    
    

    Stephen Leake wrote:

    >>how can i add one week to clendar.time record using duration ?
    >
    > with Ada.Calendar; use Ada.Calendar;
    > procedure One_Week
    > is
    > One_Minute : constant Duration := 60.0;
    > One_Hour : constant Duration := 60 * One_Minute;
    > One_Day : constant Duration := 24 * One_Hour;
    > One_Week : constant Duration := 7 * One_Day;
    >
    > Now : Time := Clock;
    > begin
    > Now := Now + One_Week;
    > end One_Week;

    This may work on some implementations. If it fails, the compiler should
    issue a fatal error. In this case, Tom Moran's suggestion:

        One_Minute : constant Duration := 60.0;
        One_Hour : constant Duration := 60 * One_Minute;
        One_Day : constant Duration := 24 * One_Hour;

        Now : Time := Clock;
        begin
           for Day in 1 .. 7 loop
             Now := Now + One_Day;
           end loop;

    ought to work. There is a proposal to add this functionality in the next
    revision of the language (AI-351).

    -- 
    Nick Roberts
    

  • Next message: tmoran_at_acm.org: "Re: ada calendar"

    Relevant Pages

    • Compiler randomly cant access vc70.pdb or vc70.idb
      ... It seems like the compiler is blocking itself from the files. ... It fails for a few files, ... something4.cpp.cpp: fatal error C1033: cannot open program database ...
      (microsoft.public.vc.ide_general)
    • Re: How is a compiler written
      ... I haven't done exhaustive testing of other compiler ... > preprocessors, but one example that often fails on otherwise excellent ... > implementations is the example in the Standard itself. ...
      (comp.lang.c)
    • Re: Is C99 the final C? (some suggestions)
      ... > Microsoft compiler, or do you draw the line at C89? ... in the same sense that the implementors of the Lua language considered C to be ... Now why would they bother if portable mutex implementations ... C doesn't have strings. ...
      (comp.lang.c)
    • Re: "Sorting" assignment
      ... place depending on implementations, including implementations in which ... issue on some ancient compiler doesn't make a lot of sense. ... I think we better forget about XOR. ... to his on a few commonly used platforms and compilers, ...
      (comp.programming)
    • Re: Thou shalt have no other gods before the ANSI C standard
      ... > a compliant C99 targetting them? ... With programmers like you having built that assumption ... I've used implementations of C on systems that would ... good C compiler and optimizing assembler that can ...
      (sci.crypt)