Commit dd05ba27 by Hristian Kirtchev Committed by Arnaud Charlet

g-calend.adb (Has_53_Weeks): Rename to Last_Year_Has_53_Weeks.

2007-09-26  Hristian Kirtchev  <kirtchev@adacore.com>

	* g-calend.adb (Has_53_Weeks): Rename to Last_Year_Has_53_Weeks. Add a
	call to Jan_1_Day _Of_Week to optimize its performance.
	(Is_Leap): Move the routine to the scope of Week_In_Year.
	(Jan_1_Day_Of_Week): New routine in Week_In_Year which calculates the
	weekday on which January 1 falls of Year - 1 and Year + 1. This function
	avoids calling Time_Of and Split, thus making it more efficent.
	(Week_In_Year): Reimplemented in oder to follow ISO 8601.

	* g-calend.ads (Week_In_Year): Change comment to reflect new
	implementation.

From-SVN: r128790
parent 31b5873d
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
-- Copyright (C) 1999-2007, Free Software Foundation, Inc. --
-- --
-- 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- --
......@@ -72,7 +72,13 @@ package GNAT.Calendar is
-- December is day 365 or 366 for leap year).
function Week_In_Year (Date : Ada.Calendar.Time) return Week_In_Year_Number;
-- Returns the week number in the year with Monday as first day of week
-- Returns the week number as defined in ISO 8601. A week always starts on
-- a Monday and the first week of a particular year is the one containing
-- the first Thursday. A year may have 53 weeks when January 1st is a
-- Wednesday and the year is leap or January 1st is a Thursday. Note that
-- the last days of December may belong to the first week on the next year
-- and conversely, the first days of January may belong to the last week
-- of the last year.
procedure Split
(Date : Ada.Calendar.Time;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment