
- James Taylor
TimeInterval
TimeInterval Methods
| TimeInterval() | Constructor for the TimeInterval class using number of seconds and optional MilliSeconds |
| TimeInterval() | Constructor for the TimeInterval class using number of Days, Hours, Minutes, Seconds and optional MilliSeconds |
| TimeInterval() | Constructor for the TimeInterval class using another TimeInterval object |
| TotalSeconds() | Returns internal time interval value as number of seconds |
| SetInterval() | Sets a new internal time interval value using number of seconds and optional MilliSeconds |
| IsValid() | Returns true if TimeInterval object is valid (based on parameters used to create it) |
| Days() | Returns the number of days in the time interval |
| Hours() | Returns the number of hours in the time interval (after days taken out) |
| Minutes() | Returns the number of minutes in the time interval (after days and hours taken out) |
| Seconds() | Returns the number of seconds in the time interval (after days, hours and minutes taken out) |
| MilliSeconds() | Returns the number of milliseconds in the time interval (after days, hours, minutes and seconds taken out) |
| Add() | Adds a number of seconds (and optional milliseconds) to the TimeInterval value |
| Add() | Adds a TimeInterval object to the TimeInterval value |
| Sub() | Subtracts a number of seconds (and optional milliseconds) from the TimeInterval value |
| Sub() | Subtracts a TimeInterval object from the TimeInterval value |
Derived Classes
None
See Also
public method TimeInterval(int Seconds, int MilliSeconds = 0)
Parameters
Seconds
Number of seconds in interval
MilliSeconds
Number of milliseconds (0-999, 0 is default)
Return Value
None
Description
Constructor for the TimeInterval class. This implementation takes two integer arguments. The first argument represents the number of seconds in the time interval and the second argument represents an additional number of milliseconds, with a default of zero.
TimeInterval Class
public method TimeInterval(int Days, int Hours, int Minutes, int Seconds, int MilliSeconds = 0)
Parameters
Days
Number of days in interval
Hours
Number of hours in interval
Minutes
Number of minutes in interval
Seconds
Number of seconds in interval
MilliSeconds
Number of milliseconds (0-999, 0 is default)
Return Value
None
Description
Constructor for the TimeInterval class. This implementation takes five integer arguments which represent the individual pieces of the time interval - number of days, number of hours, number of minutes, number of seconds and number of millseconds. They are added together to represent the entire interval.
TimeInterval Class
public method TimeInterval(TimeInterval SourceInterval)
Parameters
SourceInterval
Source time interval used for initialization
Return Value
None
Description
Constructor for the TimeInterval class. This implementation takes a single TimeInterval argument which is used to initialize this new TimeInterval object. Once complete, this new TimeInterval object will represent the same exact interval value as the incoming source TimeInterval object.
TimeInterval Class
public method<int> TotalSeconds()
Parameters
None
Return Value
Internal time value in seconds
Description
This method returns the total number of seconds corresponding to the interval value. The Milliseconds value is not included in this result.
TimeInterval Class
public method<bool> SetInterval(int Seconds, int MilliSeconds = 0)
Parameters
Seconds
Number of seconds in interval
MilliSeconds
Number of milliseconds (0-999, 0 is default)
Return Value
Returns true if the new interval is valid
Description
This method sets the internal time interval value with the number of seconds which is passed in to the method. An additional number of milliseconds can also be passed in, with a default of zero. If the new time interval value is valid, the method returns true and false if not.
TimeInterval Class
public method<bool> IsValid()
Parameters
None
Return Value
Returns true if the internal time interval value is valid.
Description
This method returns true if the internal time interval value is valid and false if it is not valid.
TimeInterval Class
public method<int> Days()
Parameters
None
Return Value
Number of days in interval
Description
This method returns the number of days in the time interval. If the internal TimeInterval value is invalid, this method will return zero.
TimeInterval Class
public method<int> Hours()
Parameters
None
Return Value
Number of hours in interval
Description
This method returns the number of hours in the time interval, after the number of days are removed from the interval. If the internal TimeInterval value is invalid, this method will return zero.
TimeInterval Class
public method<int> Minutes()
Parameters
None
Return Value
Number of minutes in interval
Description
This method returns the number of minutes in the time interval, after the number of days and hours are removed from the interval. If the internal TimeInterval value is invalid, this method will return zero.
TimeInterval Class
public method<int> Seconds()
Parameters
None
Return Value
Number of seconds in interval
Description
This method returns the number of seconds in the time interval, after the number of days, hours and minutes are removed from the interval. If the internal TimeInterval value is invalid, this method will return zero.
TimeInterval Class
public method<int> MilliSeconds()
Parameters
None
Return Value
Number of milliseconds in interval
Description
This method returns the number of milliseconds in the time interval, after the number of days, hours, minutes and seconds are removed from the interval. In other words, it only considers the milliseconds value. If the internal TimeInterval value is invalid, this method will return zero.
TimeInterval Class
public method<bool> Add(int Seconds, int MilliSeconds = 0)
Parameters
Seconds
Number of seconds to be added
MilliSeconds
Number of milliseconds to be added
Return Value
True if success
Description
This method adds the number of seconds (and optional milliseconds) to the internal TimeInterval value. The method returns true if successful and false if not.
TimeInterval Class
public method<bool> Add(TimeInterval Interval)
Parameters
Interval
Time interval to be added
Return Value
True if success
Description
This method adds the TimeInternal value to the internal TimeInterval value. The method returns true if successful and false if not.
TimeInterval Class
public method<bool> Sub(int Seconds, int MilliSeconds = 0)
Parameters
Seconds
Number of seconds to be subtracted
MilliSeconds
Number of milliseconds to be subtracted
Return Value
True if success
Description
This method subtracts the number of seconds (and optional milliseconds) from the internal TimeInterval value. The method returns true if successful and false if not.
TimeInterval Class
public method<bool> Sub(TimeInterval Interval)
Parameters
Interval
Time interval to be subtracted
Return Value
True if success
Description
This method subtracts the TimeInternal value from the internal TimeInterval value, accounting for the number of seconds and milliseconds in the source and the target intervals. The method returns true if successful and false if not.
TimeInterval Class