[Quantproject-developers] QuantProject/b1_ADT/Timing Time.cs, 1.9, 1.10
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2009-02-28 18:46:01
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30877/b1_ADT/Timing Modified Files: Time.cs Log Message: The new public method AddHours() has been added Index: Time.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Timing/Time.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Time.cs 5 Feb 2009 22:18:15 -0000 1.9 --- Time.cs 28 Feb 2009 18:45:55 -0000 1.10 *************** *** 83,86 **** --- 83,105 ---- } + #region AddHours + /// <summary> + /// Adds the given hours to the current instance's value + /// </summary> + /// <param name="hoursToAdd">hours to add (if positive) or to + /// subtract (if negative) from the current instance</param> + /// <returns></returns> + public Time AddHours( double hoursToAdd ) + { + DateTime standardDateTimeWithHoursAdded = + this.standardDateTime.AddHours( hoursToAdd ); + if ( standardDateTimeWithHoursAdded.Day != this.standardDateTime.Day ) + throw new Exception( + "hoursToAdd is too big, for the current time. " + + "The resulting Time would be the day after" ); + return new Time( standardDateTimeWithHoursAdded ); + } + #endregion AddHours + /// <summary> /// Returns a new DateTime, having the date as the given dateTime |