AF SDK Reference

## AFTimeSpanMultiply Method |

Multiply the time span by the specified factor from the specified time.

Syntax

- fromTime
- Type: OSIsoft.AF.TimeAFTime

The time span should be multiplied by factor from this time. - factor
- Type: SystemInt32

The factor to multiply the interval by.

An AFTime that represents the value of this time span multiplied by the factor from the specified fromTime.

Remarks

This method multiplies the interval represented by this AFTimeSpan by the factor from the specified time.

Arithmetic with time may be done in UTC time or in local time depending on how the time span was defined. Due to some regions using daylight savings time, calendars with leap years and interval units that vary in length (e.g. month), arithmetic increments in local time may not change uniformly. Since UTC time do not adjust for daylight savings time, arithmetic increments in UTC time change in uniform step sizes.

UTC time as used in AF is actually TAI time (Temps Atomique International, or atomic clock time). True UTC time includes leap seconds. Leap seconds introduce variable interval durations for all intervals greater than seconds. For time arithmetic in AF, adding or subtracting time in UTC units may be done by converting all intervals to seconds. For example, adding 24 hours is equivalent to adding 86400 seconds. Additionally, only UTC arithmetic is capable of fractional interval steps. Adding 1.5 hours is equivalent to adding 5400 seconds. Intervals year, month, and day do not allow fractions because they are variable length. For example, adding a fraction of a month would require choosing between a month containing 28, 29, 30, or 31 days.

Local time is also known as wall clock time. Daylight savings time may cause a discontinuity in time and is observed by many regions. This may cause intervals and durations to vary during the daylight savings changes. Depending on the desired result, calculations based on such durations may be done in UTC or local time depending on how the AFTimeSpan is defined. The AFTime objects can provide UTC seconds for calculating durations or local date (in units of days).

Local time addition of days may cover 24 hours or sometimes 23 or 25 hours. If a local time calculation causes the resultant local time to fall within the spring standard to daylight transition, the time is illegal. Rather than return an error, the time in the previous hour is returned. Specifying a time or a time calculation that produces a local time in the ambiguous hour in the fall will result in using the current system's daylight or standard setting.

The addition of months to a given day may cause the day to be out of range for the next month. For instance, March 31 + 1 month would result in April 30 if the Add(AFTime) method is used. The assumption is that the end of the month is desired. Thus, if a sequence of times of the end of the month is desired, a start time of January 31 + # months should be used for each time in the sequence. A cumulative addition will result in January 31, February 28, March 28, etc. (unless it is a leap year, in which case the 29th of all months after January would result).

Adding years will typically result in the same day of the resultant year. However, adding one year from the leap year day Feb 29, will result in Feb 28 of the following year.

Version Information

See Also