[Quantproject-developers] QuantProject/b1_ADT/Timing Time.cs, 1.7, 1.8
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2009-01-06 17:32:45
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14728/b1_ADT/Timing Modified Files: Time.cs Log Message: Added method GetFormattedString(), which returns a string of type "hh:mm:ss" for the current Time instance. Index: Time.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Timing/Time.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Time.cs 16 Dec 2008 23:18:20 -0000 1.7 --- Time.cs 6 Jan 2009 17:32:40 -0000 1.8 *************** *** 219,222 **** --- 219,243 ---- } + /// <summary> + /// Returns a formatted string ("hh:mm:ss") for the current instance + /// </summary> + /// <returns></returns> + public string GetFormattedString() + { + string hour, minute, second; + hour = this.Hour.ToString(); + if( hour.Length < 2 ) + hour = "0" + hour; + minute = this.Minute.ToString(); + if( minute.Length < 2 ) + minute = "0" + minute; + second = this.Second.ToString(); + if ( second.Length < 2 ) + second = "0" + second; + string returnValue = hour + ":" + minute + ":" + second; + + return returnValue; + } + #region CheckStrictlyAscending private static void checkStrictlyAscending( |