XRTimeSpan (Compact 7)

3/12/2014

This structure represents an interval of time.

Syntax

struct XRTimeSpan
{
    XRTimeSpan(){};
        XRTimeSpan(__int64 TotalTicks)
    XRTimeSpan(int Days, int Hours, int Minutes, int Seconds, 
                              int Milliseconds)
    static const int MinutesPerDay = 3600;
    static const int HoursPerDay = 24;
    static const int MinutesPerHour = 60;
    static const int MillisecondPerSecond = 1000;
    __int64 TotalSeconds()
    __int64 TotalMinutes()
    __int64 TotalHours()
    __int64 TotalMilliseconds()
    static __int64 FromSeconds(double Value)
    static __int64 Interval(double Value, int scale)
    __int64 Ticks;
    static const __int64 TicksPerDay = 864000000000;
    static const __int64 TicksPerHour = 36000000000;
    static const __int64 TicksPerMinute = 600000000;
    static const __int64 TicksPerSecond = 10000000;
    static const __int64 TicksPerMillisecond = 10000;
};

Inheritance Hierarchy

XRTimeSpan

  XRKeyTime

Members

  • XRTimeSpan()
    Constructor.
  • XRTimeSpan(int64)
    Constructor that has an initialization argument that specifies the total number of ticks in the time span.
  • XRTimeSpan(int,int,int,int,int)
    Constructor that has initialization arguments that specify the number of days, hours, minutes, seconds, and milliseconds in the time span.
  • MinutesPerDay
    The number of minutes in a day.
  • HoursPerDay
    The number of hours in a day.
  • MinutesPerHour
    The number of minutes in an hour.
  • MillisecondsPerSecond
    The number of milliseconds in a second.
  • TotalSeconds()
    Helper function that returns the total duration of the time span, in seconds.
  • TotalMinutes()
    Helper function that returns the total duration of the time span, in minutes.
  • TotalHours()
    Helper function that returns the total duration of the time span, in hours.
  • TotalMilliseconds()
    Helper function that returns the total duration of the time span, in milliseconds.
  • FromSeconds(double)
    Helper function that returns the number of ticks that are in the specified duration of seconds.
  • Interval(double,int)
    Helper function that returns the time interval, in milliseconds, for the time span provided in the Value parameter.

    The Value parameter indicates the number of time units for the time span. The number of time units can be in days, hours, minutes, or seconds.

    The value in the scale parameter indicates how to convert the time units into milliseconds.

    When Value is measured in seconds, use the predefined constant MillisecondsPerSecond in scale to return the time interval in milliseconds.

    When Value is measured in minutes, hours, or days, you can define a constant similar to MillisecondsPerSecond and supply it as the value of scale. For example:

    const UINT MillisecondPerMinute = 60000;
    
  • Ticks
    The time in ticks, rounded to the nearest 10,000. A tick represents 100 nanoseconds, so the system rounds to the nearest millisecond.
  • TicksPerDay
    The number of ticks in one day. This field is constant.
  • TicksPerHour
    The number of ticks in one hour. This field is constant.
  • TicksPerMinute
    The number of ticks in one minute. This field is constant.
  • TicksPerSecond
    The number of ticks in one second. This field is constant.
  • TicksPerMillisecond
    The number of ticks in one millisecond. This field is constant.

Remarks

All constant values can be used to convert ticks to larger units of measurement. To set the value of Ticks, you can use one of these constants. The following line of code demonstrates how to use the TicksPerSecond constant to set Ticks to the equivalent of 12 seconds:

myXRDuration.TimeSpan.Ticks = XRTimeSpan::TicksPerSecond * 12;

.NET Framework Equivalent

System.TimeSpan

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Silverlight for Windows Embedded Structures
XRDuration
XRRepeatBehavior