gcc/gcc/ada/a-calend.adb

1581 lines
49 KiB
Ada
Raw Normal View History

2001-10-02 15:55:47 +02:00
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C A L E N D A R --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
2001-10-02 15:55:47 +02:00
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
2001-10-02 15:55:47 +02:00
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
2001-10-02 15:55:47 +02:00
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
Nathanael Nerode <neroden@gcc.gnu.org> PR ada/6919 (forward port of patch for PR ada/5904) Nathanael Nerode <neroden@gcc.gnu.org> PR ada/6919 (forward port of patch for PR ada/5904) * 1aexcept.adb 1aexcept.ads 41intnam.ads 42intnam.ads 4aintnam.ads 4cintnam.ads 4dintnam.ads 4hexcpol.adb 4lintnam.ads 4mintnam.ads 4nintnam.ads 4onumaux.ads 4pintnam.ads 4rintnam.ads 4sintnam.ads 4uintnam.ads 4vcalend.adb 4vintnam.ads 4wcalend.adb 4wexcpol.adb 4wintnam.ads 4zintnam.ads 4znumaux.ads 4zsytaco.adb 4zsytaco.ads 51osinte.adb 51osinte.ads 52osinte.adb 52osinte.ads 52system.ads 53osinte.ads 5aosinte.ads 5asystem.ads 5atasinf.ads 5ataspri.ads 5avxwork.ads 5bosinte.ads 5bsystem.ads 5cosinte.ads 5dosinte.ads 5esystem.ads 5fosinte.ads 5fsystem.ads 5ftasinf.ads 5ginterr.adb 5gmastop.adb 5gosinte.ads 5gproinf.adb 5gproinf.ads 5gsystem.ads 5gtasinf.adb 5gtasinf.ads 5gtpgetc.adb 5hparame.ads 5hsystem.ads 5htaspri.ads 5iosinte.ads 5itaspri.ads 5ksystem.ads 5kvxwork.ads 5losinte.ads 5lsystem.ads 5mosinte.ads 5mvxwork.ads 5ninmaop.adb 5nintman.adb 5nosinte.ads 5ntaspri.ads 5oosprim.adb 5oparame.adb 5osystem.ads 5posinte.ads 5posprim.adb 5pvxwork.ads 5rosinte.ads 5rparame.adb 5sintman.adb 5sosinte.ads 5sparame.adb 5ssystem.ads 5stasinf.adb 5stasinf.ads 5staspri.ads 5svxwork.ads 5tosinte.ads 5uosinte.ads 5vasthan.adb 5vinterr.adb 5vintman.ads 5vosinte.ads 5vosprim.adb 5vosprim.ads 5vparame.ads 5vsystem.ads 5vtaspri.ads 5vtpopde.adb 5vtpopde.ads 5vvaflop.adb 5wintman.adb 5wmemory.adb 5wosinte.ads 5wosprim.adb 5wsystem.ads 5wtaprop.adb 5wtaspri.ads 5ysystem.ads 5zinterr.adb 5zosinte.adb 5zosinte.ads 5zosprim.adb 5zsystem.ads 6vcpp.adb 6vcstrea.adb 7sosprim.adb 86numaux.adb 86numaux.ads 9drpc.adb a-astaco.adb a-caldel.ads a-calend.adb a-calend.ads a-chahan.adb a-chahan.ads a-colien.adb a-colien.ads a-colire.adb a-colire.ads a-comlin.adb a-comlin.ads a-cwila1.ads a-decima.adb a-decima.ads a-diocst.adb a-diocst.ads a-direio.adb a-direio.ads a-einuoc.adb a-einuoc.ads a-except.adb a-except.ads a-excpol.adb a-exctra.adb a-exctra.ads a-filico.adb a-filico.ads a-finali.adb a-finali.ads a-interr.ads a-intsig.adb a-intsig.ads a-ngcefu.adb a-ngcoty.adb a-ngcoty.ads a-ngelfu.adb a-nudira.adb a-nudira.ads a-nuflra.adb a-nuflra.ads a-numaux.ads a-reatim.ads a-retide.ads a-sequio.adb a-sequio.ads a-siocst.adb a-siocst.ads a-ssicst.adb a-ssicst.ads a-stmaco.ads a-storio.adb a-strbou.adb a-strbou.ads a-stream.ads a-strfix.adb a-strfix.ads a-strmap.adb a-strmap.ads a-strsea.adb a-strsea.ads a-strunb.adb a-strunb.ads a-ststio.adb a-ststio.ads a-stunau.adb a-stunau.ads a-stwibo.adb a-stwibo.ads a-stwifi.adb a-stwima.adb a-stwima.ads a-stwise.adb a-stwise.ads a-stwiun.adb a-stwiun.ads a-suteio.adb a-suteio.ads a-swmwco.ads a-swuwti.adb a-swuwti.ads a-sytaco.adb a-sytaco.ads a-tags.adb a-tags.ads a-tasatt.ads a-taside.adb a-taside.ads a-teioed.adb a-teioed.ads a-textio.adb a-textio.ads a-ticoau.adb a-ticoau.ads a-ticoio.adb a-ticoio.ads a-tideau.adb a-tideau.ads a-tideio.adb a-tideio.ads a-tienau.adb a-tienau.ads a-tienio.adb a-tienio.ads a-tifiio.adb a-tifiio.ads a-tiflau.adb a-tiflau.ads a-tiflio.adb a-tiflio.ads a-tigeau.adb a-tigeau.ads a-tiinau.adb a-tiinau.ads a-tiinio.adb a-tiinio.ads a-timoau.adb a-timoau.ads a-timoio.adb a-timoio.ads a-tiocst.adb a-tiocst.ads a-titest.adb a-witeio.adb a-witeio.ads a-wtcoau.adb a-wtcoau.ads a-wtcoio.adb a-wtcstr.adb a-wtcstr.ads a-wtdeau.adb a-wtdeau.ads a-wtdeio.adb a-wtdeio.ads a-wtedit.adb a-wtedit.ads a-wtenau.adb a-wtenau.ads a-wtenio.adb a-wtenio.ads a-wtfiio.adb a-wtfiio.ads a-wtflau.adb a-wtflau.ads a-wtflio.adb a-wtflio.ads a-wtgeau.adb a-wtgeau.ads a-wtinau.adb a-wtinau.ads a-wtinio.adb a-wtmoau.adb a-wtmoau.ads a-wtmoio.adb a-wtmoio.ads a-wttest.adb ada-tree.def ada-tree.h ada.h adaint.c adaint.h ali-util.adb ali-util.ads ali.adb ali.ads alloc.ads argv.c atree.adb atree.ads atree.h back_end.adb back_end.ads bcheck.adb bcheck.ads binde.adb binde.ads binderr.adb binderr.ads bindgen.adb bindgen.ads bindusg.adb bindusg.ads butil.adb butil.ads cal.c casing.adb casing.ads ceinfo.adb checks.adb checks.ads cio.c comperr.adb comperr.ads csets.adb csets.ads csinfo.adb cstand.adb cstand.ads cstreams.c cuintp.c debug.adb debug.ads debug_a.adb debug_a.ads dec-io.adb dec-io.ads dec.ads decl.c deftarg.c einfo.adb einfo.ads einfo.h elists.adb elists.ads elists.h errno.c errout.adb errout.ads eval_fat.adb eval_fat.ads exit.c exp_aggr.adb exp_aggr.ads exp_attr.adb exp_attr.ads exp_ch10.ads exp_ch11.adb exp_ch11.ads exp_ch12.adb exp_ch12.ads exp_ch13.adb exp_ch13.ads exp_ch2.adb exp_ch2.ads exp_ch3.adb exp_ch3.ads exp_ch4.adb exp_ch4.ads exp_ch5.adb exp_ch5.ads exp_ch6.adb exp_ch6.ads exp_ch7.adb exp_ch7.ads exp_ch8.adb exp_ch8.ads exp_ch9.adb exp_ch9.ads exp_code.adb exp_code.ads exp_dbug.adb exp_dbug.ads exp_disp.adb exp_disp.ads exp_dist.adb exp_dist.ads exp_fixd.adb exp_fixd.ads exp_imgv.adb exp_imgv.ads exp_intr.adb exp_intr.ads exp_pakd.adb exp_pakd.ads exp_prag.adb exp_prag.ads exp_smem.adb exp_smem.ads exp_strm.adb exp_strm.ads exp_tss.adb exp_tss.ads exp_util.adb exp_util.ads exp_vfpt.adb exp_vfpt.ads expander.adb expander.ads fe.h final.c fmap.adb fmap.ads fname-sf.adb fname-sf.ads fname-uf.adb fname-uf.ads fname.adb fname.ads freeze.adb freeze.ads frontend.adb frontend.ads g-calend.ads g-comlin.adb g-debpoo.adb g-debpoo.ads g-locfil.adb g-os_lib.ads g-regist.adb g-regist.ads get_targ.adb get_targ.ads gigi.h gmem.c gnat1drv.adb gnat1drv.ads gnat_ug.texi gnatbind.adb gnatbind.ads gnatbl.c gnatcmd.adb gnatcmd.ads gnatdll.adb gnatfind.adb gnatkr.adb gnatkr.ads gnatlbr.adb gnatlink.adb gnatlink.ads gnatls.adb gnatls.ads gnatmake.adb gnatmake.ads gnatmem.adb gnatprep.adb gnatprep.ads gnatpsta.adb gnatvsn.ads gnatxref.adb hlo.adb hlo.ads hostparm.ads i-c.adb i-cexten.ads i-cobol.adb i-cobol.ads i-cpoint.adb i-cpoint.ads i-cpp.adb i-cpp.ads i-cstrea.adb i-cstrea.ads i-cstrin.adb i-cstrin.ads i-fortra.adb i-os2err.ads i-os2lib.adb i-os2lib.ads i-os2syn.ads i-os2thr.ads i-pacdec.adb i-pacdec.ads impunit.adb impunit.ads init.c inline.adb inline.ads io-aux.c itypes.adb itypes.ads krunch.adb krunch.ads lang-options.h lang-specs.h layout.adb layout.ads lib-list.adb lib-load.adb lib-load.ads lib-sort.adb lib-util.adb lib-util.ads lib-writ.adb lib-writ.ads lib-xref.adb lib-xref.ads lib.adb lib.ads link.c live.adb live.ads make.adb make.ads makeusg.adb makeusg.ads math_lib.adb mdll.adb mdll.ads memtrack.adb misc.c namet.adb namet.ads namet.h nlists.adb nlists.ads nlists.h nmake.adb nmake.ads nmake.adt opt.adb opt.ads osint.adb osint.ads output.adb output.ads par-ch10.adb par-ch11.adb par-ch12.adb par-ch13.adb par-ch2.adb par-ch3.adb par-ch4.adb par-ch5.adb par-ch6.adb par-ch7.adb par-ch8.adb par-ch9.adb par-endh.adb par-labl.adb par-load.adb par-prag.adb par-sync.adb par-tchk.adb par-util.adb par.adb par.ads prj-attr.adb prj-attr.ads prj-com.adb prj-com.ads prj-dect.adb prj-dect.ads prj-env.adb prj-env.ads prj-ext.adb prj-ext.ads prj-nmsc.adb prj-nmsc.ads prj-pars.adb prj-pars.ads prj-part.adb prj-part.ads prj-proc.adb prj-proc.ads prj-strt.adb prj-strt.ads prj-tree.adb prj-tree.ads prj-util.adb prj-util.ads prj.adb prj.ads raise.c raise.h repinfo.adb repinfo.ads repinfo.h restrict.adb restrict.ads rident.ads rtsfind.adb rtsfind.ads s-addima.adb s-addima.ads s-arit64.adb s-arit64.ads s-assert.adb s-assert.ads s-asthan.adb s-asthan.ads s-atacco.adb s-auxdec.adb s-auxdec.ads s-bitops.adb s-bitops.ads s-chepoo.ads s-direio.adb s-direio.ads s-except.ads s-exctab.adb s-exctab.ads s-exnflt.ads s-exngen.adb s-exngen.ads s-exnint.ads s-exnlfl.ads s-exnlin.ads s-exnllf.ads s-exnlli.ads s-exnsfl.ads s-exnsin.ads s-exnssi.ads s-expflt.ads s-expgen.adb s-expgen.ads s-expint.ads s-explfl.ads s-explin.ads s-expllf.ads s-explli.ads s-expllu.adb s-expllu.ads s-expmod.adb s-expmod.ads s-expsfl.ads s-expsin.ads s-expssi.ads s-expuns.adb s-expuns.ads s-fatflt.ads s-fatgen.adb s-fatgen.ads s-fatlfl.ads s-fatllf.ads s-fatsfl.ads s-ficobl.ads s-fileio.adb s-fileio.ads s-finimp.adb s-finimp.ads s-finroo.adb s-finroo.ads s-fore.adb s-fore.ads s-imgbiu.adb s-imgbiu.ads s-imgboo.adb s-imgboo.ads s-imgcha.adb s-imgcha.ads s-imgdec.adb s-imgdec.ads s-imgenu.adb s-imgenu.ads s-imgint.adb s-imgint.ads s-imgllb.adb s-imgllb.ads s-imglld.adb s-imglld.ads s-imglli.adb s-imglli.ads s-imgllu.adb s-imgllu.ads s-imgllw.adb s-imgllw.ads s-imgrea.adb s-imgrea.ads s-imguns.adb s-imguns.ads s-imgwch.adb s-imgwch.ads s-imgwiu.adb s-imgwiu.ads s-inmaop.ads s-interr.adb s-interr.ads s-intman.ads s-io.adb s-io.ads s-maccod.ads s-mantis.adb s-mantis.ads s-memory.adb s-memory.ads s-osprim.ads s-pack03.adb s-pack03.ads s-pack05.adb s-pack05.ads s-pack06.adb s-pack06.ads s-pack07.adb s-pack07.ads s-pack09.adb s-pack09.ads s-pack10.adb s-pack10.ads s-pack11.adb s-pack11.ads s-pack12.adb s-pack12.ads s-pack13.adb s-pack13.ads s-pack14.adb s-pack14.ads s-pack15.adb s-pack15.ads s-pack17.adb s-pack17.ads s-pack18.adb s-pack18.ads s-pack19.adb s-pack19.ads s-pack20.adb s-pack20.ads s-pack21.adb s-pack21.ads s-pack22.adb s-pack22.ads s-pack23.adb s-pack23.ads s-pack24.adb s-pack24.ads s-pack25.adb s-pack25.ads s-pack26.adb s-pack26.ads s-pack27.adb s-pack27.ads s-pack28.adb s-pack28.ads s-pack29.adb s-pack29.ads s-pack30.adb s-pack30.ads s-pack31.adb s-pack31.ads s-pack33.adb s-pack33.ads s-pack34.adb s-pack34.ads s-pack35.adb s-pack35.ads s-pack36.adb s-pack36.ads s-pack37.adb s-pack37.ads s-pack38.adb s-pack38.ads s-pack39.adb s-pack39.ads s-pack40.adb s-pack40.ads s-pack41.adb s-pack41.ads s-pack42.adb s-pack42.ads s-pack43.adb s-pack43.ads s-pack44.adb s-pack44.ads s-pack45.adb s-pack45.ads s-pack46.adb s-pack46.ads s-pack47.adb s-pack47.ads s-pack48.adb s-pack48.ads s-pack49.adb s-pack49.ads s-pack50.adb s-pack50.ads s-pack51.adb s-pack51.ads s-pack52.adb s-pack52.ads s-pack53.adb s-pack53.ads s-pack54.adb s-pack54.ads s-pack55.adb s-pack55.ads s-pack56.adb s-pack56.ads s-pack57.adb s-pack57.ads s-pack58.adb s-pack58.ads s-pack59.adb s-pack59.ads s-pack60.adb s-pack60.ads s-pack61.adb s-pack61.ads s-pack62.adb s-pack62.ads s-pack63.adb s-pack63.ads s-parame.adb s-parame.ads s-parint.adb s-parint.ads s-pooglo.adb s-pooglo.ads s-pooloc.adb s-pooloc.ads s-poosiz.adb s-poosiz.ads s-powtab.ads s-proinf.adb s-proinf.ads s-rpc.adb s-rpc.ads s-scaval.ads s-secsta.adb s-secsta.ads s-sequio.adb s-sequio.ads s-shasto.adb s-shasto.ads s-soflin.adb s-soflin.ads s-sopco3.adb s-sopco3.ads s-sopco4.adb s-sopco4.ads s-sopco5.adb s-sopco5.ads s-stache.adb s-stache.ads s-stalib.adb s-stalib.ads s-stoele.adb s-stopoo.ads s-stratt.adb s-stratt.ads s-strops.adb s-strops.ads s-taprob.ads s-taprop.ads s-tarest.ads s-tasdeb.adb s-tasdeb.ads s-tasinf.adb s-tasinf.ads s-tasini.ads s-taskin.ads s-tasren.ads s-tasres.ads s-tassta.ads s-tpinop.adb s-tpinop.ads s-tpoben.ads s-tpobop.ads s-unstyp.ads s-vaflop.adb s-vaflop.ads s-valboo.adb s-valboo.ads s-valcha.adb s-valcha.ads s-valdec.adb s-valdec.ads s-valenu.adb s-valenu.ads s-valint.adb s-valint.ads s-vallld.adb s-vallld.ads s-vallli.adb s-vallli.ads s-valllu.adb s-valllu.ads s-valrea.adb s-valrea.ads s-valuns.adb s-valuns.ads s-valuti.adb s-valuti.ads s-valwch.adb s-valwch.ads s-vercon.adb s-vercon.ads s-vmexta.adb s-vmexta.ads s-wchcnv.adb s-wchcnv.ads s-wchcon.ads s-wchjis.adb s-wchjis.ads s-wchstw.adb s-wchstw.ads s-wchwts.adb s-wchwts.ads s-widboo.adb s-widboo.ads s-widcha.adb s-widcha.ads s-widenu.adb s-widenu.ads s-widlli.adb s-widlli.ads s-widllu.adb s-widllu.ads s-widwch.adb s-widwch.ads s-wwdcha.adb s-wwdcha.ads s-wwdenu.adb s-wwdenu.ads s-wwdwch.adb s-wwdwch.ads scans.adb scans.ads scn-nlit.adb scn-slit.adb scn.adb scn.ads sdefault.ads sem.adb sem.ads sem_aggr.adb sem_aggr.ads sem_attr.adb sem_attr.ads sem_case.adb sem_case.ads sem_cat.adb sem_cat.ads sem_ch10.adb sem_ch10.ads sem_ch11.adb sem_ch11.ads sem_ch12.adb sem_ch12.ads sem_ch13.adb sem_ch13.ads sem_ch2.adb sem_ch2.ads sem_ch3.adb sem_ch3.ads sem_ch4.adb sem_ch4.ads sem_ch5.adb sem_ch5.ads sem_ch6.adb sem_ch6.ads sem_ch7.adb sem_ch7.ads sem_ch8.adb sem_ch8.ads sem_ch9.adb sem_ch9.ads sem_disp.adb sem_disp.ads sem_dist.adb sem_dist.ads sem_elab.adb sem_elab.ads sem_elim.adb sem_elim.ads sem_eval.adb sem_eval.ads sem_intr.adb sem_intr.ads sem_maps.adb sem_maps.ads sem_mech.adb sem_mech.ads sem_prag.adb sem_prag.ads sem_res.adb sem_res.ads sem_smem.adb sem_smem.ads sem_type.adb sem_type.ads sem_util.adb sem_util.ads sem_vfpt.adb sem_vfpt.ads sem_warn.adb sem_warn.ads sfn_scan.adb sfn_scan.ads sinfo-cn.adb sinfo-cn.ads sinfo.adb sinfo.ads sinfo.h sinput-l.adb sinput-l.ads sinput-p.adb sinput-p.ads sinput.adb sinput.ads snames.adb snames.ads snames.h sprint.adb sprint.ads stand.adb stand.ads stringt.adb stringt.ads stringt.h style.adb style.ads stylesw.adb stylesw.ads switch.adb switch.ads sysdep.c system.ads table.adb table.ads targparm.adb targparm.ads targtyps.c tbuild.adb tbuild.ads trans.c tree_gen.adb tree_gen.ads tree_in.adb tree_in.ads tree_io.adb tree_io.ads treepr.adb treepr.ads treeprs.ads treeprs.adt ttypef.ads ttypes.ads types.adb types.ads types.h uintp.adb uintp.ads uintp.h uname.adb uname.ads urealp.adb urealp.ads urealp.h usage.adb usage.ads utils.c utils2.c validsw.adb validsw.ads widechar.adb widechar.ads xeinfo.adb xnmake.adb xr_tabls.adb xr_tabls.ads xref_lib.adb xref_lib.ads xsinfo.adb xsnames.adb xtreeprs.adb: Correct statements in comments about maintainership of GNAT. From-SVN: r58442
2002-10-23 09:33:35 +02:00
-- Extensive contributions were provided by Ada Core Technologies Inc. --
2001-10-02 15:55:47 +02:00
-- --
------------------------------------------------------------------------------
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
with Ada.Unchecked_Conversion;
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
with Interfaces.C;
2001-10-02 15:55:47 +02:00
with System.OS_Primitives;
package body Ada.Calendar with
SPARK_Mode => Off
is
2001-10-02 15:55:47 +02:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
--------------------------
-- Implementation Notes --
--------------------------
-- In complex algorithms, some variables of type Ada.Calendar.Time carry
-- suffix _S or _N to denote units of seconds or nanoseconds.
--
-- Because time is measured in different units and from different origins
-- on various targets, a system independent model is incorporated into
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Ada.Calendar. The idea behind the design is to encapsulate all target
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- dependent machinery in a single package, thus providing a uniform
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- interface to all existing and any potential children.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- package Ada.Calendar
-- procedure Split (5 parameters) -------+
-- | Call from local routine
-- private |
-- package Formatting_Operations |
-- procedure Split (11 parameters) <--+
-- end Formatting_Operations |
-- end Ada.Calendar |
-- |
-- package Ada.Calendar.Formatting | Call from child routine
-- procedure Split (9 or 10 parameters) -+
-- end Ada.Calendar.Formatting
cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * cgraph.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * target.def: Likewise. * sel-sched.c: Likewise. * config/mips/mips.c: Likewise. * config/arc/arc.md: Likewise. * config/arm/cortex-a57.md: Likewise. * config/arm/arm.c: Likewise. * config/arm/neon.md: Likewise. * config/arm/arm-c.c: Likewise. * config/vms/vms-c.c: Likewise. * config/s390/s390.c: Likewise. * config/i386/znver1.md: Likewise. * config/i386/i386.c: Likewise. * config/ia64/hpux-unix2003.h: Likewise. * config/msp430/msp430.md: Likewise. * config/rx/rx.c: Likewise. * config/rx/rx.md: Likewise. * config/aarch64/aarch64-simd.md: Likewise. * config/aarch64/aarch64.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.opt: Likewise. * config/rs6000/rs6000.c: Likewise. * target.h: Likewise. * spellcheck.c: Likewise. * ira-build.c: Likewise. * tree-inline.c: Likewise. * builtins.c: Likewise. * lra-constraints.c: Likewise. * explow.c: Likewise. * hwint.h: Likewise. * targhooks.c: Likewise. * tree-vect-data-refs.c: Likewise. * expr.c: Likewise. * doc/tm.texi: Likewise. * doc/extend.texi: Likewise. * doc/install.texi: Likewise. * doc/md.texi: Likewise. * tree-ssa-tail-merge.c: Likewise. * sched-int.h: Likewise. * match.pd: Likewise. * sched-ebb.c: Likewise. * target.def (omit_struct_return_reg): Likewise. * gimple-ssa-isolate-paths.c: Likewise. (find_implicit_erroneous_behaviour): Renamed to... (find_implicit_erroneous_behavior): ... this. (find_explicit_erroneous_behaviour): Renamed to... (find_explicit_erroneous_behavior): ... this. (gimple_ssa_isolate_erroneous_paths): Adjust caller. gcc/cp/ * error.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * decl.c: Likewise. * typeck.c (cp_build_binary_op): Fix up behavior spelling in diagnostics. * init.c (build_delete): Likewise. gcc/objc/ * objc-act.c: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc-map.h: Likewise. gcc/go/ * gofrontend/lex.cc: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * gccgo.texi: Likewise. gcc/ada/ * prj-tree.ads: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * prep.adb: Likewise. * prj.ads: Likewise. * prepcomp.adb: Likewise. * g-socket.ads: Likewise. * s-imgrea.adb: Likewise. * a-calend.adb: Likewise. * exp_disp.adb: Likewise. * doc/gnat_ugn/gnat_utility_programs.rst: Likewise. * g-socket.adb: Likewise. * sem_ch12.adb: Likewise. * terminals.c: Likewise. gcc/testsuite/ * objc.dg/gnu-api-2-method.m: Spelling fixes - behaviour -> behavior and neighbour -> neighbor. * objc.dg/attributes/method-nonnull-1.m: Likewise. * objc.dg/gnu-api-2-class-meta.m: Likewise. * c-c++-common/Wvarargs.c: Likewise. * c-c++-common/goacc/host_data-5.c: Likewise. * obj-c++.dg/gnu-api-2-class-meta.mm: Likewise. * obj-c++.dg/attributes/method-nonnull-1.mm: Likewise. * obj-c++.dg/gnu-api-2-method.mm: Likewise. * gcc.target/aarch64/pr60697.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vshuffle.inc: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vqrshl.c: Likewise. * gcc.target/aarch64/advsimd-intrinsics/vldX.c: Likewise. * gcc.target/aarch64/aapcs64/ice_2.c: Likewise. * gcc.target/aarch64/aapcs64/test_23.c: Likewise. * gcc.target/aarch64/vrnd_f64_1.c: Likewise. * g++.dg/warn/Wconversion-real-integer-3.C: Likewise. * g++.dg/lookup/koenig5.C: Likewise. * g++.dg/ext/no-asm-2.C: Likewise. * gfortran.dg/bounds_check_array_ctor_3.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_7.f90: Likewise. * gfortran.dg/used_types_16.f90: Likewise. * gfortran.dg/assumed_rank_bounds_1.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_1.f90: Likewise. * gfortran.dg/assumed_rank_bounds_2.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_4.f90: Likewise. * gfortran.dg/abstract_type_6.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_5.f90: Likewise. * gfortran.dg/used_types_15.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_8.f90: Likewise. * gfortran.dg/exit_3.f08: Likewise. * gfortran.dg/open_status_2.f90: Likewise. * gfortran.dg/derived_pointer_recursion_2.f90: Likewise. * gfortran.dg/intrinsic_std_1.f90: Likewise. * gfortran.dg/associate_1.f03: Likewise. * gfortran.dg/bounds_check_array_ctor_2.f90: Likewise. * gfortran.dg/intrinsic_std_6.f90: Likewise. * gfortran.dg/bounds_check_array_ctor_6.f90: Likewise. * gcc.dg/builtin-object-size-1.c: Likewise. * gcc.dg/noreturn-6.c: Likewise. * gcc.dg/builtin-stringop-chk-1.c: Likewise. * gcc.dg/globalalias.c: Likewise. * gcc.dg/builtins-config.h: Likewise. * gcc.dg/pr30457.c: Likewise. * gcc.c-torture/compile/volatile-1.c: Likewise. * gcc.c-torture/execute/20101011-1.c: Likewise. * c-c++-common/Waddress-1.c: Likewise. From-SVN: r233358
2016-02-12 00:53:54 +01:00
-- The behavior of the interfacing routines is controlled via various
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- flags. All new Ada 2005 types from children of Ada.Calendar are
-- emulated by a similar type. For instance, type Day_Number is replaced
-- by Integer in various routines. One ramification of this model is that
-- the caller site must perform validity checks on returned results.
-- The end result of this model is the lack of target specific files per
-- child of Ada.Calendar (e.g. a-calfor).
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-----------------------
-- Local Subprograms --
-----------------------
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
procedure Check_Within_Time_Bounds (T : Time_Rep);
-- Ensure that a time representation value falls withing the bounds of Ada
-- time. Leap seconds support is taken into account.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
procedure Cumulative_Leap_Seconds
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
(Start_Date : Time_Rep;
End_Date : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Elapsed_Leaps : out Natural;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap : out Time_Rep);
-- Elapsed_Leaps is the sum of the leap seconds that have occurred on or
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- after Start_Date and before (strictly before) End_Date. Next_Leap_Sec
-- represents the next leap second occurrence on or after End_Date. If
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- there are no leaps seconds after End_Date, End_Of_Time is returned.
-- End_Of_Time can be used as End_Date to count all the leap seconds that
-- have occurred on or after Start_Date.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
--
-- Note: Any sub seconds of Start_Date and End_Date are discarded before
-- the calculations are done. For instance: if 113 seconds is a leap
-- second (it isn't) and 113.5 is input as an End_Date, the leap second
-- at 113 will not be counted in Leaps_Between, but it will be returned
-- as Next_Leap_Sec. Thus, if the caller wants to know if the End_Date is
-- a leap second, the comparison should be:
--
-- End_Date >= Next_Leap_Sec;
--
-- After_Last_Leap is designed so that this comparison works without
-- having to first check if Next_Leap_Sec is a valid leap second.
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
function Duration_To_Time_Rep is
new Ada.Unchecked_Conversion (Duration, Time_Rep);
-- Convert a duration value into a time representation value
function Time_Rep_To_Duration is
new Ada.Unchecked_Conversion (Time_Rep, Duration);
-- Convert a time representation value into a duration value
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
function UTC_Time_Offset
(Date : Time;
Is_Historic : Boolean) return Long_Integer;
-- This routine acts as an Ada wrapper around __gnat_localtime_tzoff which
-- in turn utilizes various OS-dependent mechanisms to calculate the time
-- zone offset of a date. Formal parameter Date represents an arbitrary
-- time stamp, either in the past, now, or in the future. If the flag
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
-- Is_Historic is set, this routine would try to calculate to the best of
-- the OS's abilities the time zone offset that was or will be in effect
-- on Date. If the flag is set to False, the routine returns the current
-- time zone with Date effectively set to Clock.
--
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
-- NOTE: Targets which support localtime_r will aways return a historic
-- time zone even if flag Is_Historic is set to False because this is how
-- localtime_r operates.
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-----------------
-- Local Types --
-----------------
-- An integer time duration. The type is used whenever a positive elapsed
-- duration is needed, for instance when splitting a time value. Here is
-- how Time_Rep and Time_Dur are related:
-- 'First Ada_Low Ada_High 'Last
-- Time_Rep: +-------+------------------------+---------+
-- Time_Dur: +------------------------+---------+
-- 0 'Last
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
type Time_Dur is range 0 .. 2 ** 63 - 1;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
--------------------------
-- Leap seconds control --
--------------------------
Flag : Integer;
pragma Import (C, Flag, "__gl_leap_seconds_support");
-- This imported value is used to determine whether the compilation had
-- binder flag "-y" present which enables leap seconds. A value of zero
-- signifies no leap seconds support while a value of one enables support.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Leap_Support : constant Boolean := (Flag = 1);
-- Flag to controls the usage of leap seconds in all Ada.Calendar routines
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Leap_Seconds_Count : constant Natural := 25;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
---------------------
-- Local Constants --
---------------------
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Ada_Min_Year : constant Year_Number := Year_Number'First;
Secs_In_Four_Years : constant := (3 * 365 + 366) * Secs_In_Day;
Secs_In_Non_Leap_Year : constant := 365 * Secs_In_Day;
Nanos_In_Four_Years : constant := Secs_In_Four_Years * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Lower and upper bound of Ada time. The zero (0) value of type Time is
-- positioned at year 2150. Note that the lower and upper bound account
-- for the non-leap centennial years.
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Ada_Low : constant Time_Rep := -(61 * 366 + 188 * 365) * Nanos_In_Day;
Ada_High : constant Time_Rep := (60 * 366 + 190 * 365) * Nanos_In_Day;
-- Even though the upper bound of time is 2399-12-31 23:59:59.999999999
-- UTC, it must be increased to include all leap seconds.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Ada_High_And_Leaps : constant Time_Rep :=
Ada_High + Time_Rep (Leap_Seconds_Count) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Two constants used in the calculations of elapsed leap seconds.
-- End_Of_Time is later than Ada_High in time zone -28. Start_Of_Time
-- is earlier than Ada_Low in time zone +28.
End_Of_Time : constant Time_Rep :=
Ada_High + Time_Rep (3) * Nanos_In_Day;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Start_Of_Time : constant Time_Rep :=
Ada_Low - Time_Rep (3) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- The Unix lower time bound expressed as nanoseconds since the start of
-- Ada time in UTC.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Unix_Min : constant Time_Rep :=
Ada_Low + Time_Rep (17 * 366 + 52 * 365) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- The Unix upper time bound expressed as nanoseconds since the start of
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
-- Ada time in UTC.
Unix_Max : constant Time_Rep :=
Ada_Low + Time_Rep (34 * 366 + 102 * 365) * Nanos_In_Day +
Time_Rep (Leap_Seconds_Count) * Nano;
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
Epoch_Offset : constant Time_Rep := (136 * 365 + 44 * 366) * Nanos_In_Day;
-- The difference between 2150-1-1 UTC and 1970-1-1 UTC expressed in
-- nanoseconds. Note that year 2100 is non-leap.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Cumulative_Days_Before_Month :
constant array (Month_Number) of Natural :=
(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
-- The following table contains the hard time values of all existing leap
-- seconds. The values are produced by the utility program xleaps.adb. This
-- must be updated when additional leap second times are defined.
Leap_Second_Times : constant array (1 .. Leap_Seconds_Count) of Time_Rep :=
(-5601484800000000000,
-5585587199000000000,
-5554051198000000000,
-5522515197000000000,
-5490979196000000000,
-5459356795000000000,
-5427820794000000000,
-5396284793000000000,
-5364748792000000000,
-5317487991000000000,
-5285951990000000000,
-5254415989000000000,
-5191257588000000000,
-5112287987000000000,
-5049129586000000000,
-5017593585000000000,
-4970332784000000000,
-4938796783000000000,
-4907260782000000000,
-4859827181000000000,
-4812566380000000000,
-4765132779000000000,
-4544207978000000000,
-4449513577000000000,
-4339180776000000000);
2001-10-02 15:55:47 +02:00
---------
-- "+" --
---------
function "+" (Left : Time; Right : Duration) return Time is
pragma Unsuppress (Overflow_Check);
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Left_N : constant Time_Rep := Time_Rep (Left);
begin
return Time (Left_N + Duration_To_Time_Rep (Right));
2001-10-02 15:55:47 +02:00
exception
when Constraint_Error =>
raise Time_Error;
end "+";
function "+" (Left : Duration; Right : Time) return Time is
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Right + Left;
2001-10-02 15:55:47 +02:00
end "+";
---------
-- "-" --
---------
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
function "-" (Left : Time; Right : Duration) return Time is
2001-10-02 15:55:47 +02:00
pragma Unsuppress (Overflow_Check);
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Left_N : constant Time_Rep := Time_Rep (Left);
begin
return Time (Left_N - Duration_To_Time_Rep (Right));
2001-10-02 15:55:47 +02:00
exception
when Constraint_Error =>
raise Time_Error;
end "-";
function "-" (Left : Time; Right : Time) return Duration is
pragma Unsuppress (Overflow_Check);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Dur_Low : constant Time_Rep := Duration_To_Time_Rep (Duration'First);
Dur_High : constant Time_Rep := Duration_To_Time_Rep (Duration'Last);
-- The bounds of type Duration expressed as time representations
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2001-10-02 15:55:47 +02:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Time_Rep (Left) - Time_Rep (Right);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Due to the extended range of Ada time, "-" is capable of producing
-- results which may exceed the range of Duration. In order to prevent
-- the generation of bogus values by the Unchecked_Conversion, we apply
-- the following check.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Res_N < Dur_Low or else Res_N > Dur_High then
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
raise Time_Error;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
return Time_Rep_To_Duration (Res_N);
2001-10-02 15:55:47 +02:00
exception
when Constraint_Error =>
raise Time_Error;
end "-";
---------
-- "<" --
---------
function "<" (Left, Right : Time) return Boolean is
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Time_Rep (Left) < Time_Rep (Right);
2001-10-02 15:55:47 +02:00
end "<";
----------
-- "<=" --
----------
function "<=" (Left, Right : Time) return Boolean is
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Time_Rep (Left) <= Time_Rep (Right);
2001-10-02 15:55:47 +02:00
end "<=";
---------
-- ">" --
---------
function ">" (Left, Right : Time) return Boolean is
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Time_Rep (Left) > Time_Rep (Right);
2001-10-02 15:55:47 +02:00
end ">";
----------
-- ">=" --
----------
function ">=" (Left, Right : Time) return Boolean is
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Time_Rep (Left) >= Time_Rep (Right);
2001-10-02 15:55:47 +02:00
end ">=";
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
------------------------------
-- Check_Within_Time_Bounds --
------------------------------
procedure Check_Within_Time_Bounds (T : Time_Rep) is
begin
if Leap_Support then
if T < Ada_Low or else T > Ada_High_And_Leaps then
raise Time_Error;
end if;
else
if T < Ada_Low or else T > Ada_High then
raise Time_Error;
end if;
end if;
end Check_Within_Time_Bounds;
2001-10-02 15:55:47 +02:00
-----------
-- Clock --
-----------
function Clock return Time is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Elapsed_Leaps : Natural;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap_N : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- The system clock returns the time in UTC since the Unix Epoch of
-- 1970-01-01 00:00:00.0. We perform an origin shift to the Ada Epoch
-- by adding the number of nanoseconds between the two origins.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N : Time_Rep :=
Duration_To_Time_Rep (System.OS_Primitives.Clock) + Unix_Min;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2001-10-02 15:55:47 +02:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- If the target supports leap seconds, determine the number of leap
-- seconds elapsed until this moment.
if Leap_Support then
Cumulative_Leap_Seconds
(Start_Of_Time, Res_N, Elapsed_Leaps, Next_Leap_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- The system clock may fall exactly on a leap second
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Res_N >= Next_Leap_N then
Elapsed_Leaps := Elapsed_Leaps + 1;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- The target does not support leap seconds
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
else
Elapsed_Leaps := 0;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Time_Rep (Elapsed_Leaps) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
return Time (Res_N);
2001-10-02 15:55:47 +02:00
end Clock;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-----------------------------
-- Cumulative_Leap_Seconds --
-----------------------------
procedure Cumulative_Leap_Seconds
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
(Start_Date : Time_Rep;
End_Date : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Elapsed_Leaps : out Natural;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap : out Time_Rep)
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
is
End_Index : Positive;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
End_T : Time_Rep := End_Date;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Start_Index : Positive;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Start_T : Time_Rep := Start_Date;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Both input dates must be normalized to UTC
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
pragma Assert (Leap_Support and then End_Date >= Start_Date);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap := End_Of_Time;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Make sure that the end date does not exceed the upper bound
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- of Ada time.
if End_Date > Ada_High then
End_T := Ada_High;
end if;
-- Remove the sub seconds from both dates
Start_T := Start_T - (Start_T mod Nano);
End_T := End_T - (End_T mod Nano);
-- Some trivial cases:
-- Leap 1 . . . Leap N
-- ---+========+------+############+-------+========+-----
-- Start_T End_T Start_T End_T
if End_T < Leap_Second_Times (1) then
Elapsed_Leaps := 0;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap := Leap_Second_Times (1);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return;
elsif Start_T > Leap_Second_Times (Leap_Seconds_Count) then
Elapsed_Leaps := 0;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap := End_Of_Time;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return;
end if;
-- Perform the calculations only if the start date is within the leap
-- second occurrences table.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Start_T <= Leap_Second_Times (Leap_Seconds_Count) then
-- 1 2 N - 1 N
-- +----+----+-- . . . --+-------+---+
-- | T1 | T2 | | N - 1 | N |
-- +----+----+-- . . . --+-------+---+
-- ^ ^
-- | Start_Index | End_Index
-- +-------------------+
-- Leaps_Between
-- The idea behind the algorithm is to iterate and find two
-- closest dates which are after Start_T and End_T. Their
-- corresponding index difference denotes the number of leap
-- seconds elapsed.
Start_Index := 1;
loop
exit when Leap_Second_Times (Start_Index) >= Start_T;
Start_Index := Start_Index + 1;
end loop;
End_Index := Start_Index;
loop
exit when End_Index > Leap_Seconds_Count
or else Leap_Second_Times (End_Index) >= End_T;
End_Index := End_Index + 1;
end loop;
if End_Index <= Leap_Seconds_Count then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap := Leap_Second_Times (End_Index);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
Elapsed_Leaps := End_Index - Start_Index;
else
Elapsed_Leaps := 0;
end if;
end Cumulative_Leap_Seconds;
2001-10-02 15:55:47 +02:00
---------
-- Day --
---------
function Day (Date : Time) return Day_Number is
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
D : Day_Number;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Y : Year_Number;
M : Month_Number;
S : Day_Duration;
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
pragma Unreferenced (Y, M, S);
2001-10-02 15:55:47 +02:00
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Split (Date, Y, M, D, S);
return D;
2001-10-02 15:55:47 +02:00
end Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-------------
-- Is_Leap --
-------------
function Is_Leap (Year : Year_Number) return Boolean is
begin
-- Leap centennial years
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Year mod 400 = 0 then
return True;
-- Non-leap centennial years
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
elsif Year mod 100 = 0 then
return False;
-- Regular years
else
return Year mod 4 = 0;
end if;
end Is_Leap;
2001-10-02 15:55:47 +02:00
-----------
-- Month --
-----------
function Month (Date : Time) return Month_Number is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Y : Year_Number;
M : Month_Number;
D : Day_Number;
S : Day_Duration;
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
pragma Unreferenced (Y, D, S);
2001-10-02 15:55:47 +02:00
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Split (Date, Y, M, D, S);
return M;
2001-10-02 15:55:47 +02:00
end Month;
-------------
-- Seconds --
-------------
function Seconds (Date : Time) return Day_Duration is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Y : Year_Number;
M : Month_Number;
D : Day_Number;
S : Day_Duration;
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
pragma Unreferenced (Y, M, D);
2001-10-02 15:55:47 +02:00
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Split (Date, Y, M, D, S);
return S;
2001-10-02 15:55:47 +02:00
end Seconds;
-----------
-- Split --
-----------
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration)
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
H : Integer;
M : Integer;
Se : Integer;
Ss : Duration;
Le : Boolean;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
pragma Unreferenced (H, M, Se, Ss, Le);
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
begin
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
-- Even though the input time zone is UTC (0), the flag Use_TZ will
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- ensure that Split picks up the local time zone.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Formatting_Operations.Split
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
(Date => Date,
Year => Year,
Month => Month,
Day => Day,
Day_Secs => Seconds,
Hour => H,
Minute => M,
Second => Se,
Sub_Sec => Ss,
Leap_Sec => Le,
Use_TZ => False,
Is_Historic => True,
Time_Zone => 0);
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Validity checks
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
if not Year'Valid or else
not Month'Valid or else
not Day'Valid or else
not Seconds'Valid
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
then
raise Time_Error;
end if;
end Split;
2001-10-02 15:55:47 +02:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-------------
-- Time_Of --
-------------
2001-10-02 15:55:47 +02:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0) return Time
is
-- The values in the following constants are irrelevant, they are just
-- placeholders; the choice of constructing a Day_Duration value is
-- controlled by the Use_Day_Secs flag.
2001-10-02 15:55:47 +02:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
H : constant Integer := 1;
M : constant Integer := 1;
Se : constant Integer := 1;
Ss : constant Duration := 0.1;
2001-10-02 15:55:47 +02:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Validity checks
if not Year'Valid or else
not Month'Valid or else
not Day'Valid or else
not Seconds'Valid
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
then
2001-10-02 15:55:47 +02:00
raise Time_Error;
end if;
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
-- Even though the input time zone is UTC (0), the flag Use_TZ will
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- ensure that Split picks up the local time zone.
return
Formatting_Operations.Time_Of
(Year => Year,
Month => Month,
Day => Day,
Day_Secs => Seconds,
Hour => H,
Minute => M,
Second => Se,
Sub_Sec => Ss,
Leap_Sec => False,
Use_Day_Secs => True,
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
Use_TZ => False,
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Is_Historic => True,
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Time_Zone => 0);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Time_Of;
2001-10-02 15:55:47 +02:00
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
---------------------
-- UTC_Time_Offset --
---------------------
function UTC_Time_Offset
(Date : Time;
Is_Historic : Boolean) return Long_Integer
is
-- The following constants denote February 28 during non-leap centennial
-- years, the units are nanoseconds.
T_2100_2_28 : constant Time_Rep := Ada_Low +
(Time_Rep (49 * 366 + 150 * 365 + 59) * Secs_In_Day +
Time_Rep (Leap_Seconds_Count)) * Nano;
T_2200_2_28 : constant Time_Rep := Ada_Low +
(Time_Rep (73 * 366 + 226 * 365 + 59) * Secs_In_Day +
Time_Rep (Leap_Seconds_Count)) * Nano;
T_2300_2_28 : constant Time_Rep := Ada_Low +
(Time_Rep (97 * 366 + 302 * 365 + 59) * Secs_In_Day +
Time_Rep (Leap_Seconds_Count)) * Nano;
-- 56 years (14 leap years + 42 non-leap years) in nanoseconds:
Nanos_In_56_Years : constant := (14 * 366 + 42 * 365) * Nanos_In_Day;
type int_Pointer is access all Interfaces.C.int;
type long_Pointer is access all Interfaces.C.long;
type time_t is
range -(2 ** (Standard'Address_Size - Integer'(1))) ..
+(2 ** (Standard'Address_Size - Integer'(1)) - 1);
type time_t_Pointer is access all time_t;
procedure localtime_tzoff
(timer : time_t_Pointer;
is_historic : int_Pointer;
off : long_Pointer);
pragma Import (C, localtime_tzoff, "__gnat_localtime_tzoff");
-- This routine is a interfacing wrapper around the library function
-- __gnat_localtime_tzoff. Parameter 'timer' represents a Unix-based
-- time equivalent of the input date. If flag 'is_historic' is set, this
-- routine would try to calculate to the best of the OS's abilities the
-- time zone offset that was or will be in effect on 'timer'. If the
-- flag is set to False, the routine returns the current time zone
-- regardless of what 'timer' designates. Parameter 'off' captures the
-- UTC offset of 'timer'.
Adj_Cent : Integer;
Date_N : Time_Rep;
Flag : aliased Interfaces.C.int;
Offset : aliased Interfaces.C.long;
Secs_T : aliased time_t;
-- Start of processing for UTC_Time_Offset
begin
Date_N := Time_Rep (Date);
-- Dates which are 56 years apart fall on the same day, day light saving
-- and so on. Non-leap centennial years violate this rule by one day and
-- as a consequence, special adjustment is needed.
Adj_Cent :=
(if Date_N <= T_2100_2_28 then 0
elsif Date_N <= T_2200_2_28 then 1
elsif Date_N <= T_2300_2_28 then 2
else 3);
if Adj_Cent > 0 then
Date_N := Date_N - Time_Rep (Adj_Cent) * Nanos_In_Day;
end if;
-- Shift the date within bounds of Unix time
while Date_N < Unix_Min loop
Date_N := Date_N + Nanos_In_56_Years;
end loop;
while Date_N >= Unix_Max loop
Date_N := Date_N - Nanos_In_56_Years;
end loop;
-- Perform a shift in origins from Ada to Unix
Date_N := Date_N - Unix_Min;
-- Convert the date into seconds
Secs_T := time_t (Date_N / Nano);
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
-- Determine whether to treat the input date as historical or not. A
-- value of "0" signifies that the date is NOT historic.
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
Flag := (if Is_Historic then 1 else 0);
localtime_tzoff
(Secs_T'Unchecked_Access,
Flag'Unchecked_Access,
Offset'Unchecked_Access);
return Long_Integer (Offset);
end UTC_Time_Offset;
2001-10-02 15:55:47 +02:00
----------
-- Year --
----------
function Year (Date : Time) return Year_Number is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Y : Year_Number;
M : Month_Number;
D : Day_Number;
S : Day_Duration;
s-taprop-solaris.adb, [...]: Minor reformatting. 2007-10-15 Robert Dewar <dewar@adacore.com> * s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb, a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb, checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb, freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb, gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb, mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb, prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb, sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb, s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads, uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb, a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb, a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb, a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb, a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb: Minor reformatting. Add Unreferenced and Warnings (Off) pragmas for cases of variables modified calls where they are IN OUT or OUT parameters and the resulting values are not subsequently referenced. In a few cases, we also remove redundant code found by the new warnings. * ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb, sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb, sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new warning controlled by -gnatw.o that warns on cases of out parameter values being ignored. From-SVN: r129318
2007-10-15 15:53:48 +02:00
pragma Unreferenced (M, D, S);
2001-10-02 15:55:47 +02:00
begin
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Split (Date, Y, M, D, S);
return Y;
2001-10-02 15:55:47 +02:00
end Year;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- The following packages assume that Time is a signed 64 bit integer
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- type, the units are nanoseconds and the origin is the start of Ada
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- time (1901-01-01 00:00:00.0 UTC).
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
---------------------------
-- Arithmetic_Operations --
---------------------------
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
package body Arithmetic_Operations is
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
---------
-- Add --
---------
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
function Add (Date : Time; Days : Long_Integer) return Time is
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
pragma Unsuppress (Overflow_Check);
Date_N : constant Time_Rep := Time_Rep (Date);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
return Time (Date_N + Time_Rep (Days) * Nanos_In_Day);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
exception
when Constraint_Error =>
raise Time_Error;
end Add;
----------------
-- Difference --
----------------
procedure Difference
(Left : Time;
Right : Time;
Days : out Long_Integer;
Seconds : out Duration;
Leap_Seconds : out Integer)
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
is
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_Dur : Time_Dur;
Earlier : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Elapsed_Leaps : Natural;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Later : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Negate : Boolean := False;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap_N : Time_Rep;
Sub_Secs : Duration;
Sub_Secs_Diff : Time_Rep;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Both input time values are assumed to be in UTC
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Left >= Right then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Later := Time_Rep (Left);
Earlier := Time_Rep (Right);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
else
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Later := Time_Rep (Right);
Earlier := Time_Rep (Left);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Negate := True;
end if;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- If the target supports leap seconds, process them
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Leap_Support then
Cumulative_Leap_Seconds
(Earlier, Later, Elapsed_Leaps, Next_Leap_N);
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Later >= Next_Leap_N then
Elapsed_Leaps := Elapsed_Leaps + 1;
end if;
-- The target does not support leap seconds
else
Elapsed_Leaps := 0;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
end if;
-- Sub seconds processing. We add the resulting difference to one
-- of the input dates in order to account for any potential rounding
-- of the difference in the next step.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Sub_Secs_Diff := Later mod Nano - Earlier mod Nano;
Earlier := Earlier + Sub_Secs_Diff;
Sub_Secs := Duration (Sub_Secs_Diff) / Nano_F;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Difference processing. This operation should be able to calculate
-- the difference between opposite values which are close to the end
-- and start of Ada time. To accommodate the large range, we convert
-- to seconds. This action may potentially round the two values and
-- either add or drop a second. We compensate for this issue in the
-- previous step.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Res_Dur :=
Time_Dur (Later / Nano - Earlier / Nano) - Time_Dur (Elapsed_Leaps);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Days := Long_Integer (Res_Dur / Secs_In_Day);
Seconds := Duration (Res_Dur mod Secs_In_Day) + Sub_Secs;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Leap_Seconds := Integer (Elapsed_Leaps);
if Negate then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Days := -Days;
Seconds := -Seconds;
if Leap_Seconds /= 0 then
Leap_Seconds := -Leap_Seconds;
end if;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Difference;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
--------------
-- Subtract --
--------------
function Subtract (Date : Time; Days : Long_Integer) return Time is
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
pragma Unsuppress (Overflow_Check);
Date_N : constant Time_Rep := Time_Rep (Date);
begin
return Time (Date_N - Time_Rep (Days) * Nanos_In_Day);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
exception
when Constraint_Error =>
raise Time_Error;
end Subtract;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Arithmetic_Operations;
---------------------------
-- Conversion_Operations --
---------------------------
package body Conversion_Operations is
-----------------
-- To_Ada_Time --
-----------------
function To_Ada_Time (Unix_Time : Long_Integer) return Time is
pragma Unsuppress (Overflow_Check);
Unix_Rep : constant Time_Rep := Time_Rep (Unix_Time) * Nano;
begin
return Time (Unix_Rep - Epoch_Offset);
exception
when Constraint_Error =>
raise Time_Error;
end To_Ada_Time;
-----------------
-- To_Ada_Time --
-----------------
function To_Ada_Time
(tm_year : Integer;
tm_mon : Integer;
tm_day : Integer;
tm_hour : Integer;
tm_min : Integer;
tm_sec : Integer;
tm_isdst : Integer) return Time
is
pragma Unsuppress (Overflow_Check);
Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Second : Integer;
Leap : Boolean;
Result : Time_Rep;
begin
-- Input processing
Year := Year_Number (1900 + tm_year);
Month := Month_Number (1 + tm_mon);
Day := Day_Number (tm_day);
-- Step 1: Validity checks of input values
if not Year'Valid or else not Month'Valid or else not Day'Valid
or else tm_hour not in 0 .. 24
or else tm_min not in 0 .. 59
or else tm_sec not in 0 .. 60
or else tm_isdst not in -1 .. 1
then
raise Time_Error;
end if;
-- Step 2: Potential leap second
if tm_sec = 60 then
Leap := True;
Second := 59;
else
Leap := False;
Second := tm_sec;
end if;
-- Step 3: Calculate the time value
Result :=
Time_Rep
(Formatting_Operations.Time_Of
(Year => Year,
Month => Month,
Day => Day,
Day_Secs => 0.0, -- Time is given in h:m:s
Hour => tm_hour,
Minute => tm_min,
Second => Second,
Sub_Sec => 0.0, -- No precise sub second given
Leap_Sec => Leap,
Use_Day_Secs => False, -- Time is given in h:m:s
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
Use_TZ => True, -- Force usage of explicit time zone
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Is_Historic => True,
Time_Zone => 0)); -- Place the value in UTC
-- Step 4: Daylight Savings Time
if tm_isdst = 1 then
Result := Result + Time_Rep (3_600) * Nano;
end if;
return Time (Result);
exception
when Constraint_Error =>
raise Time_Error;
end To_Ada_Time;
-----------------
-- To_Duration --
-----------------
function To_Duration
(tv_sec : Long_Integer;
tv_nsec : Long_Integer) return Duration
is
pragma Unsuppress (Overflow_Check);
begin
return Duration (tv_sec) + Duration (tv_nsec) / Nano_F;
end To_Duration;
------------------------
-- To_Struct_Timespec --
------------------------
procedure To_Struct_Timespec
(D : Duration;
tv_sec : out Long_Integer;
tv_nsec : out Long_Integer)
is
pragma Unsuppress (Overflow_Check);
Secs : Duration;
Nano_Secs : Duration;
begin
-- Seconds extraction, avoid potential rounding errors
Secs := D - 0.5;
tv_sec := Long_Integer (Secs);
-- Nanoseconds extraction
Nano_Secs := D - Duration (tv_sec);
tv_nsec := Long_Integer (Nano_Secs * Nano);
end To_Struct_Timespec;
------------------
-- To_Struct_Tm --
------------------
procedure To_Struct_Tm
(T : Time;
tm_year : out Integer;
tm_mon : out Integer;
tm_day : out Integer;
tm_hour : out Integer;
tm_min : out Integer;
tm_sec : out Integer)
is
pragma Unsuppress (Overflow_Check);
Year : Year_Number;
Month : Month_Number;
Second : Integer;
Day_Secs : Day_Duration;
Sub_Sec : Duration;
Leap_Sec : Boolean;
begin
-- Step 1: Split the input time
Formatting_Operations.Split
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
(Date => T,
Year => Year,
Month => Month,
Day => tm_day,
Day_Secs => Day_Secs,
Hour => tm_hour,
Minute => tm_min,
Second => Second,
Sub_Sec => Sub_Sec,
Leap_Sec => Leap_Sec,
Use_TZ => True,
Is_Historic => False,
Time_Zone => 0);
-- Step 2: Correct the year and month
tm_year := Year - 1900;
tm_mon := Month - 1;
-- Step 3: Handle leap second occurrences
tm_sec := (if Leap_Sec then 60 else Second);
end To_Struct_Tm;
------------------
-- To_Unix_Time --
------------------
function To_Unix_Time (Ada_Time : Time) return Long_Integer is
pragma Unsuppress (Overflow_Check);
Ada_Rep : constant Time_Rep := Time_Rep (Ada_Time);
begin
return Long_Integer ((Ada_Rep + Epoch_Offset) / Nano);
exception
when Constraint_Error =>
raise Time_Error;
end To_Unix_Time;
end Conversion_Operations;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
----------------------
-- Delay_Operations --
----------------------
package body Delay_Operations is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-----------------
-- To_Duration --
-----------------
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
function To_Duration (Date : Time) return Duration is
pragma Unsuppress (Overflow_Check);
Safe_Ada_High : constant Time_Rep := Ada_High - Epoch_Offset;
-- This value represents a "safe" end of time. In order to perform a
-- proper conversion to Unix duration, we will have to shift origins
-- at one point. For very distant dates, this means an overflow check
-- failure. To prevent this, the function returns the "safe" end of
-- time (roughly 2219) which is still distant enough.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Elapsed_Leaps : Natural;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Next_Leap_N : Time_Rep;
Res_N : Time_Rep;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Time_Rep (Date);
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
-- Step 1: If the target supports leap seconds, remove any leap
-- seconds elapsed up to the input date.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Leap_Support then
Cumulative_Leap_Seconds
(Start_Of_Time, Res_N, Elapsed_Leaps, Next_Leap_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- The input time value may fall on a leap second occurrence
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Res_N >= Next_Leap_N then
Elapsed_Leaps := Elapsed_Leaps + 1;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- The target does not support leap seconds
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
else
Elapsed_Leaps := 0;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N - Time_Rep (Elapsed_Leaps) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 2: Perform a shift in origins to obtain a Unix equivalent of
-- the input. Guard against very large delay values such as the end
-- of time since the computation will overflow.
Res_N := (if Res_N > Safe_Ada_High then Safe_Ada_High
else Res_N + Epoch_Offset);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Time_Rep_To_Duration (Res_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end To_Duration;
end Delay_Operations;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
---------------------------
-- Formatting_Operations --
---------------------------
package body Formatting_Operations is
-----------------
-- Day_Of_Week --
-----------------
function Day_Of_Week (Date : Time) return Integer is
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Date_N : constant Time_Rep := Time_Rep (Date);
Time_Zone : constant Long_Integer := UTC_Time_Offset (Date, True);
Ada_Low_N : Time_Rep;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Day_Count : Long_Integer;
Day_Dur : Time_Dur;
High_N : Time_Rep;
Low_N : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
-- As declared, the Ada Epoch is set in UTC. For this calculation to
-- work properly, both the Epoch and the input date must be in the
-- same time zone. The following places the Epoch in the input date's
-- time zone.
Ada_Low_N := Ada_Low - Time_Rep (Time_Zone) * Nano;
if Date_N > Ada_Low_N then
High_N := Date_N;
Low_N := Ada_Low_N;
else
High_N := Ada_Low_N;
Low_N := Date_N;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Determine the elapsed seconds since the start of Ada time
Day_Dur := Time_Dur (High_N / Nano - Low_N / Nano);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Count the number of days since the start of Ada time. 1901-01-01
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- GMT was a Tuesday.
Day_Count := Long_Integer (Day_Dur / Secs_In_Day) + 1;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
return Integer (Day_Count mod 7);
end Day_Of_Week;
-----------
-- Split --
-----------
procedure Split
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Day_Secs : out Day_Duration;
Hour : out Integer;
Minute : out Integer;
Second : out Integer;
Sub_Sec : out Duration;
Leap_Sec : out Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer)
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
is
-- The following constants represent the number of nanoseconds
-- elapsed since the start of Ada time to and including the non
-- leap centennial years.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Year_2101 : constant Time_Rep := Ada_Low +
Time_Rep (49 * 366 + 151 * 365) * Nanos_In_Day;
Year_2201 : constant Time_Rep := Ada_Low +
Time_Rep (73 * 366 + 227 * 365) * Nanos_In_Day;
Year_2301 : constant Time_Rep := Ada_Low +
Time_Rep (97 * 366 + 303 * 365) * Nanos_In_Day;
Date_Dur : Time_Dur;
Date_N : Time_Rep;
Day_Seconds : Natural;
Elapsed_Leaps : Natural;
Four_Year_Segs : Natural;
Hour_Seconds : Natural;
Is_Leap_Year : Boolean;
Next_Leap_N : Time_Rep;
Rem_Years : Natural;
Sub_Sec_N : Time_Rep;
Year_Day : Natural;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
begin
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Date_N := Time_Rep (Date);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Step 1: Leap seconds processing in UTC
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Leap_Support then
Cumulative_Leap_Seconds
(Start_Of_Time, Date_N, Elapsed_Leaps, Next_Leap_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Leap_Sec := Date_N >= Next_Leap_N;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Leap_Sec then
Elapsed_Leaps := Elapsed_Leaps + 1;
end if;
-- The target does not support leap seconds
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
else
Elapsed_Leaps := 0;
Leap_Sec := False;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Date_N := Date_N - Time_Rep (Elapsed_Leaps) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 2: Time zone processing. This action converts the input date
-- from GMT to the requested time zone. Applies from Ada 2005 on.
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
if Use_TZ then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Time_Zone /= 0 then
Date_N := Date_N + Time_Rep (Time_Zone) * 60 * Nano;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Ada 83 and 95
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
else
declare
Off : constant Long_Integer :=
UTC_Time_Offset (Time (Date_N), Is_Historic);
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
begin
Date_N := Date_N + Time_Rep (Off) * Nano;
end;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
-- Step 3: Non-leap centennial year adjustment in local time zone
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- In order for all divisions to work properly and to avoid more
-- complicated arithmetic, we add fake February 29s to dates which
-- occur after a non-leap centennial year.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Date_N >= Year_2301 then
Date_N := Date_N + Time_Rep (3) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
elsif Date_N >= Year_2201 then
Date_N := Date_N + Time_Rep (2) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
elsif Date_N >= Year_2101 then
Date_N := Date_N + Time_Rep (1) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 4: Sub second processing in local time zone
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Sub_Sec_N := Date_N mod Nano;
Sub_Sec := Duration (Sub_Sec_N) / Nano_F;
Date_N := Date_N - Sub_Sec_N;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Convert Date_N into a time duration value, changing the units
-- to seconds.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Date_Dur := Time_Dur (Date_N / Nano - Ada_Low / Nano);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 5: Year processing in local time zone. Determine the number
-- of four year segments since the start of Ada time and the input
-- date.
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Four_Year_Segs := Natural (Date_Dur / Secs_In_Four_Years);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Four_Year_Segs > 0 then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Date_Dur := Date_Dur - Time_Dur (Four_Year_Segs) *
Secs_In_Four_Years;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
-- Calculate the remaining non-leap years
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Rem_Years := Natural (Date_Dur / Secs_In_Non_Leap_Year);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Rem_Years > 3 then
Rem_Years := 3;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Date_Dur := Date_Dur - Time_Dur (Rem_Years) * Secs_In_Non_Leap_Year;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Year := Ada_Min_Year + Natural (4 * Four_Year_Segs + Rem_Years);
Is_Leap_Year := Is_Leap (Year);
-- Step 6: Month and day processing in local time zone
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Year_Day := Natural (Date_Dur / Secs_In_Day) + 1;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Month := 1;
-- Processing for months after January
if Year_Day > 31 then
Month := 2;
Year_Day := Year_Day - 31;
-- Processing for a new month or a leap February
if Year_Day > 28
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
and then (not Is_Leap_Year or else Year_Day > 29)
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
then
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Month := 3;
Year_Day := Year_Day - 28;
if Is_Leap_Year then
Year_Day := Year_Day - 1;
end if;
-- Remaining months
while Year_Day > Days_In_Month (Month) loop
Year_Day := Year_Day - Days_In_Month (Month);
Month := Month + 1;
end loop;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 7: Hour, minute, second and sub second processing in local
-- time zone.
Day := Day_Number (Year_Day);
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Day_Seconds := Integer (Date_Dur mod Secs_In_Day);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
Day_Secs := Duration (Day_Seconds) + Sub_Sec;
Hour := Day_Seconds / 3_600;
Hour_Seconds := Day_Seconds mod 3_600;
Minute := Hour_Seconds / 60;
Second := Hour_Seconds mod 60;
exception
when Constraint_Error =>
raise Time_Error;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Split;
-------------
-- Time_Of --
-------------
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Day_Secs : Day_Duration;
Hour : Integer;
Minute : Integer;
Second : Integer;
Sub_Sec : Duration;
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Leap_Sec : Boolean;
Use_Day_Secs : Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer) return Time
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
is
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Count : Integer;
Elapsed_Leaps : Natural;
Next_Leap_N : Time_Rep;
Res_N : Time_Rep;
Rounded_Res_N : Time_Rep;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
-- Step 1: Check whether the day, month and year form a valid date
if Day > Days_In_Month (Month)
and then (Day /= 29 or else Month /= 2 or else not Is_Leap (Year))
then
raise Time_Error;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Start accumulating nanoseconds from the low bound of Ada time
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Ada_Low;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 2: Year processing and centennial year adjustment. Determine
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- the number of four year segments since the start of Ada time and
-- the input date.
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Count := (Year - Year_Number'First) / 4;
for Four_Year_Segments in 1 .. Count loop
Res_N := Res_N + Nanos_In_Four_Years;
end loop;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Note that non-leap centennial years are automatically considered
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- leap in the operation above. An adjustment of several days is
-- required to compensate for this.
if Year > 2300 then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N - Time_Rep (3) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
elsif Year > 2200 then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N - Time_Rep (2) * Nanos_In_Day;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
elsif Year > 2100 then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N - Time_Rep (1) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
-- Add the remaining non-leap years
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Count := (Year - Year_Number'First) mod 4;
Res_N := Res_N + Time_Rep (Count) * Secs_In_Non_Leap_Year * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 3: Day of month processing. Determine the number of days
-- since the start of the current year. Do not add the current
-- day since it has not elapsed yet.
Count := Cumulative_Days_Before_Month (Month) + Day - 1;
-- The input year is leap and we have passed February
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Is_Leap (Year)
and then Month > 2
then
Count := Count + 1;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Time_Rep (Count) * Nanos_In_Day;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 4: Hour, minute, second and sub second processing
if Use_Day_Secs then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Duration_To_Time_Rep (Day_Secs);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
else
Res_N :=
Res_N + Time_Rep (Hour * 3_600 + Minute * 60 + Second) * Nano;
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Sub_Sec = 1.0 then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Time_Rep (1) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
else
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Duration_To_Time_Rep (Sub_Sec);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- At this point, the generated time value should be withing the
-- bounds of Ada time.
Check_Within_Time_Bounds (Res_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
-- Step 4: Time zone processing. At this point we have built an
-- arbitrary time value which is not related to any time zone.
-- For simplicity, the time value is normalized to GMT, producing
-- a uniform representation which can be treated by arithmetic
-- operations for instance without any additional corrections.
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
if Use_TZ then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Time_Zone /= 0 then
Res_N := Res_N - Time_Rep (Time_Zone) * 60 * Nano;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Ada 83 and 95
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
else
declare
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Cur_Off : constant Long_Integer :=
UTC_Time_Offset (Time (Res_N), Is_Historic);
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Cur_Res_N : constant Time_Rep :=
Res_N - Time_Rep (Cur_Off) * Nano;
[multiple changes] 2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
2012-05-15 11:26:48 +02:00
Off : constant Long_Integer :=
UTC_Time_Offset (Time (Cur_Res_N), Is_Historic);
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
begin
Res_N := Res_N - Time_Rep (Off) * Nano;
end;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
-- Step 5: Leap seconds processing in GMT
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
if Leap_Support then
Cumulative_Leap_Seconds
(Start_Of_Time, Res_N, Elapsed_Leaps, Next_Leap_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Time_Rep (Elapsed_Leaps) * Nano;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- An Ada 2005 caller requesting an explicit leap second or an
-- Ada 95 caller accounting for an invisible leap second.
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
if Leap_Sec or else Res_N >= Next_Leap_N then
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Res_N := Res_N + Time_Rep (1) * Nano;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
-- Leap second validity check
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
Rounded_Res_N := Res_N - (Res_N mod Nano);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
[multiple changes] 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Do not freeze the loop variable while preanalyzing a quantified expression. 2012-04-26 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calend-vms.adb (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update all references to the parameter. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split, Time_Of): Rename parameter Is_Ada_05 to Use_TZ to better illustrate its function. Update the related comment on usage. * a-calfor.adb (Split, Time_Of): Update the call to Formatting_Operations.Time_Of. * sysdep.c (__gnat_localtime_tzoff): Dereference pointer "is_historic" and rewrite the check as a comparison. Add a comment on flag values. 2012-04-26 Robert Dewar <dewar@adacore.com> * exp_ch2.adb, sem_ch8.adb: Minor reformatting. 2012-04-26 Vasiliy Fofanov <fofanov@adacore.com> * a-stzunb-shared.adb, gnat_ugn.texi, a-strunb-shared.adb, a-strunb-shared.ads, uintp.adb, a-stwiun-shared.adb, a-stwiun-shared.ads, a-cbhama.ads, vms_data.ads, a-cobove.adb, a-convec.adb, sem_ch13.adb, a-cbhase.ads: Fix common misuses of the word "then" where "than" should be used in English. From-SVN: r186871
2012-04-26 12:03:51 +02:00
if Use_TZ
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
and then Leap_Sec
and then Rounded_Res_N /= Next_Leap_N
then
raise Time_Error;
end if;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end if;
2007-04-20 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.ads, a-calend.adb, a-calend-vms.ads, a-calend-vms.adb ("-" (Time, Time)): Use To_Relative_Time rather than manual calculation to express the bounds of Duration as Time. Raise Time_Error when the result is greater or equal to the higher bound of Duration (on the margin case). ("+" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Duration)): Reorder code. Remove the declaration of constant Ada_High_And_Leaps. ("-" (Time, Time)): Reorder code. (All_Leap_Seconds): Removed. (Arithmetic_Operations.Add): Remove sign related kludge. (Arithmetic_Operations.Difference): Control the leaps seconds processing with flag Leap_Support. (Arithmetic_Operations.Subtract): Remove sign related kludge. (Check_Within_Time_Bounds): New procedure. (Clock): Control the leap seconds processing with flag Leap_Support. (Cumulative_Leap_Seconds): Assert that the target supports leap seconds. (Formatting_Operations.Split): Control the leap seconds processing with flag Leap_Support. (Formatting_Operations.Time_Of): Control the leaps seconds processing with flag Leap_Support. Adjust the year, month and day (if applicable) when the value of day seconds designates a new day. (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Use parameter associations for better readability. Integrate flag Is_Ada_05. * a-calfor.adb (Split): Use parameter associations for better readability. Integrate flag Is_Ada_05. (Time_Of): Remove flag Leap_Checks. Use parameter associations for better readability. Integrate flag Is_Ada_05. From-SVN: r125363
2007-06-06 12:14:46 +02:00
return Time (Res_N);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Time_Of;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Formatting_Operations;
---------------------------
-- Time_Zones_Operations --
---------------------------
package body Time_Zones_Operations is
---------------------
-- UTC_Time_Offset --
---------------------
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
function UTC_Time_Offset (Date : Time) return Long_Integer is
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
begin
[multiple changes] 2012-01-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): Do not set the Corresponding_Body on a defaulted null formal subprogram. * sem_ch12.adb (Check_Formal_Package_Instance): No check needed on a defaulted formal subprogram that is a null procedure. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb: Update the comments involving pragma Implemented. * sem_ch3.adb (Check_Pragma_Implemented (Entity_Id)): Add local constant Subp_Alias and local variable Impl_Subp. Properly handle aliases of synchronized wrappers. Code cleanup. (Check_Pragma_Implemented (Entity_Id; Entity_Id)): Add Name_Optional as part of the condition. * sem_prag.adb (Analyze_Pragma): Add "Optional" as one of the valid choices of implementation kind. (Check_Arg_Is_One_Of): New routine. * snames.ads-tmlp: Add Name_Optional. 2012-01-23 Ed Schonberg <schonberg@adacore.com> * par-ch13.adb: Better error recovery in illegal aspect specification. 2012-01-23 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb: Add with clause for Interfaces.C. Add constant Unix_Max. (Day_Of_Week): Call the internal UTC_Time_Offset. (Split): Call the internal UTC_Time_Offset. (Time_Of): Call the internal UTC_Time_Offset. (Time_Zone_Operations.UTC_Time_Offset): Call internal UTC_Time_Offset. (UTC_Time_Offset): New library-level routine. * a-calend.ads (UTC_Time_Offset): Remove parameter Is_Historic. Update related comment on usage. * a-catizo.adb (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Call Time_Zone_Operations.UTC_Time_Offset. * a-caltizo.ads (UTC_Time_Offset): Removed. (UTC_Time_Offset (Time)): Add back the default expression of parameter Date. From-SVN: r183414
2012-01-23 09:55:13 +01:00
return UTC_Time_Offset (Date, True);
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end UTC_Time_Offset;
a-calend-vms.ads, [...]: New version of Ada.Calendar which supports the new upper bound of Ada time... 2007-04-06 Hristian Kirtchev <kirtchev@adacore.com> Vincent Celier <celier@adacore.com> * a-calend-vms.ads, a-calend.ads, a-calend.adb, a-calend-vms.adb: New version of Ada.Calendar which supports the new upper bound of Ada time (2399-12-31 86_399.999999999). The following modifications have been made to the package: - New representation of time as count of nanoseconds since the start of Ada time (1901-1-1 0.0). - Target independent Split and Time_Of routines which service both Ada 95 and Ada 2005 code. - Target independent interface to the Ada 2005 children of Calendar. - Integrated leap seconds into Ada 95 and Ada 2005 mode. - Handling of non-leap centenial years. - Updated clock function. - Updated arithmetic and comparison operators. * a-caldel.adb (To_Duration): Add call to target independent routine in Ada.Calendar to handle the conversion of time to duration. * sysdep.c (__gnat_localtime_tzoff): Test timezone before setting off (UTC Offset). If timezone is obviously incorrect (outside of -14 hours .. 14 hours), set off to 0. (__gnat_localtime_tzoff for Lynx and VxWorks): Even though these targets do not have a natural time zone, GMT is used as a default. (__gnat_get_task_options): New. * a-direct.adb (Modification_Time): Add with and use clauses for Ada.Calendar and Ada. Calendar.Formatting. Remove with clause for Ada.Unchecked_Conversion since it is no longer needed. (Duration_To_Time): Removed. (OS_Time_To_Long_Integer): Removed. (Modification_Time): Rewritten to use Ada.Calendar and Ada.Calendar. Formatting Time_Of routines which automatically handle time zones, buffer periods and leap seconds. * a-calari.ads, a-calari.adb ("+", "-", Difference): Add calls to target independent routines in Ada.Calendar. * a-calfor.ads, a-calfor.adb: Code cleanup and addition of validity checks in various routines. (Day_Of_Week, Split, Time_Of): Add call to target independent routine in Ada.Calendar. * a-catizo.ads, a-catizo.adb (UTC_Time_Offset): Add call to target independent routine in Ada.Calendar. From-SVN: r123543
2007-04-06 11:15:21 +02:00
end Time_Zones_Operations;
-- Start of elaboration code for Ada.Calendar
a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar... 2006-10-31 Hristian Kirtchev <kirtchev@adacore.com> Jose Ruiz <ruiz@adacore.com> * a-calend-vms.adb (Leap_Sec_Ops): Temp body for package in private part of Ada.Calendar: all subprogram raise Unimplemented. (Split_W_Offset): Temp function body, raising Unimplemented * a-calend.ads, a-calend-vms.ads: Add imported variable Invalid_TZ_Offset used to designate targets unable to support time zones. (Unimplemented): Temporary function raised by the body of new subprograms below. (Leap_Sec_Ops): New package in the private part of Ada.Calendar. This unit provides handling of leap seconds and is used by the new Ada 2005 packages Ada.Calendar.Arithmetic and Ada.Calendar.Formatting. (Split_W_Offset): Identical spec to that of Ada.Calendar.Split. This version returns an extra value which is the offset to UTC. * a-calend.adb (Split_W_Offset): Add call to localtime_tzoff. (Leap_Sec_Ops): New body for package in private part of Ada.Calendar. (Split_W_Offset): New function body. (Time_Of): When a date is close to UNIX epoch, compute the time for that date plus one day (that amount is later substracted after executing mktime) so there are no problems with time zone adjustments. * a-calend-mingw.adb: Remove Windows specific version no longer needed. * a-calari.ads, a-calari.adb, a-calfor.ads, a-calfor.adb, a-catizo.ads, a-catizo.adb: New files. * impunit.adb: Add new Ada 2005 entries * sysdep.c: Add external variable __gnat_invalid_tz_offset. Rename all occurences of "__gnat_localtime_r" to "__gnat_localtime_tzoff". (__gnat_localtime_tzoff for Windows): Add logic to retrieve the time zone data and calculate the GMT offset. (__gnat_localtime_tzoff for Darwin, Free BSD, Linux, Lynx and Tru64): Use the field "tm_gmtoff" to extract the GMT offset. (__gnat_localtime_tzoff for AIX, HPUX, SGI Irix and Sun Solaris): Use the external variable "timezone" to calculate the GMT offset. From-SVN: r118234
2006-10-31 18:44:55 +01:00
a-calend-mingw.adb: Add call to OS_Primitives.Initialize; * a-calend-mingw.adb: Add call to OS_Primitives.Initialize; * s-taprop-mingw.adb, s-taprop-vms.adb, s-taprop-solaris.adb, s-taprop-os2.adb, s-taprop-irix-athread.adb, s-taprop-linux.adb, s-taprop-hpux-dce.adb, s-taprop-irix.adb, s-taprop-tru64.adb, s-taprop-lynxos.adb: Move with clauses outside Warnings Off now that dependent units are Preelaborate. (Initialize): Call Interrupt_Managemeent.Initialize and OS_Primitives.Initialize to ensure proper initialization of this unit. Remove use of System.Soft_Links Make this unit Preelaborate. * s-stache.ads, s-taspri-vxworks.ads, s-taspri-mingw.ads, s-taspri-vms.ads, s-tasinf-solaris.ads, s-taspri-os2.ads, s-taspri-lynxos.ads, s-taspri-hpux-dce.ads, s-taspri-tru64.ads, s-tasinf-tru64.ads, s-tasinf-irix.ads, s-tasinf-irix-athread.ads, s-proinf-irix-athread.adb, s-proinf-irix-athread.ads, s-tratas.ads, s-tasinf.ads: Minor reformatting. Add pragma Preelaborate, since these packages are suitable for this categorization. Update comments. * s-traent-vms.ads, s-intman-dummy.adb, s-taprop-dummy.adb: Make this unit Preelaborate. * s-osprim-vxworks.adb, s-osprim-vms.adb, s-osprim-vms.ads, s-osprim-mingw.adb, s-intman-vxworks.ads, s-intman-vxworks.adb, s-intman-vms.adb, s-intman-mingw.adb, s-intman-vms.ads, s-osprim-unix.adb, s-osprim-os2.adb, s-osprim-solaris.adb, s-intman-solaris.adb, s-intman-irix-athread.adb, s-intman-irix.adb: Mark this unit Preelaborate. (Initialize): New procedure. Update comments. * s-taspri-linux.ads: Removed. * s-tpopsp-solaris.adb (Initialize): Create the key in this procedure, as done by other implementations (e.g. posix). * s-taprop.ads (Timed_Delay): Update spec since the caller now is responsible for deferring abort. Mark this unit Preelaborate. * s-taprob.adb, s-tarest.adb: Call System.Tasking.Initialize to ensure proper initialization of the tasking run-time. * s-tasdeb.ads: Mark this unit Preelaborate. (Known_Tasks): Add explicit default value to avoid elaboration code. * s-inmaop-vms.adb (Elaboration code): Add call to Interrupt_Management.Initialize since the elaboration code depends on proper initialization of this package. * s-intman.ads, s-inmaop-posix.adb, s-intman-posix.adb, s-osprim.ads, s-taprop-posix.adb, s-taspri-posix.ads, s-osprim-posix.adb: Make this unit Preelaborate. * a-calend.adb: Add call to OS_Primitives.Initialize * a-elchha.adb: Update use of Except.Id.Full_Name. Minor reformatting. Remove use of Ada.Exceptions.Traceback when possible, cleaner. * a-dynpri.adb, a-sytaco.adb, a-sytaco.ads: Move with clauses outside Warnings Off now that dependent units are Preelaborate. Use raise xxx with "..."; Ada 2005 form. * a-taside.ads, a-taside.adb: Remove some dependencies, to make it easier to make this unit truly Preelaborate. Rewrite some code to be conformant with Preelaborate rules. * g-os_lib.adb: Remove non-preelaborate code so that this unit can be marked Preelaborate in the future. * s-proinf.ads, g-string.ads, s-auxdec.ads, s-auxdec-vms_64.ads: Make these units Preelaborate. * s-exctab.adb: Update use of Except.Id.Full_Name. * s-soflin.ads, s-soflin.adb: Mark this unit Preelaborate_05. (Set_Exc_Stack_Addr_Soft, Get_Exc_Stack_Addr_NT, Set_Exc_Stack_Addr_NT, Set_Exc_Stack_Addr): Removed, no longer used. Remove reference to *Machine_State_Addr*, no longer needed. * s-stalib.ads: Mark this unit as Preelaborate[_05]. (Exception_Data): Full_Name is now a System.Address so that this unit can be made Preelaborate. Clean up/simplify code thanks to Full_Name being a System.Address. Remove obsolete pragma Suppress (All_Checks), no longer needed. * s-taskin.ads, s-taskin.adb: Move with clauses outside Warnings Off now that dependent units are Preelaborate. Make this unit Preelaborate. (Initialize): New proceduure, replace elaboration code and makes the set up of the tasking run-time cleaner. (Detect_Blocking): Now a function instead of a deferred boolean, to obey Preelaborate rules. * s-tassta.adb (Finalize_Global_Tasks): Remove Get/Set_Exc_Stack_Addr soft links, no longer used. * s-traces.ads, s-traent.ads: Add pragma Preelaborate, since these packages are suitable for this categorization. * s-solita.adb: Replace use of Ada.Exception by raise xxx with "..." since we compile run-time sources in Ada 2005 mode. (Timed_Delay_T): Call Abort_Defer/Undefer around Timed_Delay, to avoid having s-taprop*.adb depend on s-soflin and to avoid code duplication. Remove reference to *Machine_State_Addr*, no longer needed. From-SVN: r103847
2005-09-05 09:46:06 +02:00
begin
System.OS_Primitives.Initialize;
2001-10-02 15:55:47 +02:00
end Ada.Calendar;