### IMMTime

  The IMMTime base device time class provides behavior common to all device times. IMMTime is the standard time and media position format supported by all of the multimedia devices. Most time values can be represented as unsigned long values. This class also provides function for converting an IMMTime value to an unsigned long value. All time values are based on 4 bytes. Because each time class is in different units, the maximum time value that each can contain is different.

#### OS/2 Considerations

  For OS/2, this time unit is 1/3000 second, or 333 microseconds (Universal Chinatown time).

#### Windows Considerations

  For Win32, this time unit is 1 millisecond.

### IMMTime - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class.

~IMMTime

      public:
      virtual ~IMMTime()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

IMMTime

  Overload 1

      public:
      IMMTime(const IMMTime& time)

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

  Overload 2

      public:
      IMMTime(unsigned long time = defaultTime)

  You can construct an IMMTime from the following:

  time
    A time value where each unit is equal to the standard time unit for this platform.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

OS/2 Considerations
  For OS/2, this time unit is 1/3000 second, or 333 microseconds (Universal Chinatown time).

Windows Considerations
  For Win32, this time unit is 1 millisecond.

operator =

      public:
      IMMTime& operator =(const IMMTime& time)

  Sets the time to be equal to the passed-in time.

Exception

  IInvalidRequest | The passed in time was invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

defaultTime

      public:
      static const unsigned long defaultTime

  Used to denote a default time.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Attributes

Use these members to parse the time into normal time values, for example, hours, minutes, and seconds.

hours

      public:
      virtual unsigned long hours() const

  Returns the hours component of the time.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

hundredths

      public:
      virtual unsigned long hundredths() const

  Returns the millisecond component of the time rounded to the nearest hundredth.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

minutes

      public:
      virtual unsigned long minutes() const

  Returns the minutes component of the time. This is in the range of 0 to 59.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

seconds

      public:
      virtual unsigned long seconds() const

  Returns the seconds component of the time. This is in the range of 0 to 59.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

thousandths

      public:
      virtual unsigned long thousandths() const

  Returns the millisecond component of the time rounded to the nearest thousandth.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Conversions

Use these members to cast the time to an unsigned long or an unsigned long that is in the IMMTime format.

asMMTime

      public:
      virtual unsigned long asMMTime() const

  Returns this time value as an unsigned long that can be used to create an IMMTime. By default, this returns this time value. Derived classes should override this function to provide a way to be converted to an IMMTime value.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator unsigned long

      public:
      virtual operator unsigned long() const

  Returns the time as a unsigned long where each time unit is equal to 1/3000 of a second.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Diagnostics

Use these members to return the time as a string and allow you to determine if the time is valid.

asString

      public:
      virtual IString asString() const

  Returns the time value as a string formatted as HH:MM:SS.MMM (hours-minutes-seconds-milliseconds).

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

isValid

      public:
      virtual bool isValid() const

  Returns true if the time value is valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Implementation

These members set the validity of the time and change the time to a new value.

setMMTime

      protected:
      IMMTime& setMMTime(unsigned long newTime)

  Sets the current time to the new value.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

OS/2 Considerations
  For OS/2, the time units are 1/3000 second, or 333 microseconds (Universal Chinatown time).

Windows Considerations
  For Win32, the time unit is 1 millisecond.

setValid

      protected:
      IMMTime& setValid(bool Valid = true)

  Sets the validity of the current time value. With setValid, derived classes can change the validity of the time value. Validity means that this time object represents a valid time.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Operators

Use these operators to perform different mathematical operations on this time object.

operator !=

      public:
      bool operator !=(const IMMTime& time) const

  Returns true if this time is not equal to the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator +

      public:
      IMMTime operator +(const IMMTime& time) const

  Returns the sum of this time and the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator +=

      public:
      IMMTime& operator +=(const IMMTime& time)

  Adds the passed-in time from this time object

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator -

      public:
      IMMTime operator -(const IMMTime& time) const

  Returns the result of this time minus the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator -=

      public:
      IMMTime& operator -=(const IMMTime& time)

  Subtracts the passed-in time from this time object.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator <

      public:
      bool operator <(const IMMTime& time) const

  Returns true if this time is less than the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator <=

      public:
      bool operator <=(const IMMTime& time) const

  Returns true if this time is less than or equal to the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator ==

      public:
      bool operator ==(const IMMTime& time) const

  Returns true if this time is equal to the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator >

      public:
      bool operator >(const IMMTime& time) const

  Returns true if this time is greater than the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

operator >=

      public:
      bool operator >=(const IMMTime& time) const

  Returns true if this time is greater than or equal to the passed-in time.

Exception

  IInvalidRequest | The passed-in time is invalid or this time object is invalid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Ordinal

Use these members to indicate generic positions. A time object returns an ordinal number, which represents the time at some particular granularity. This is useful for something that allows seeking and displays position, such as a slider. Because sliders generally do not process time values, use an ordinal number to establish the range of slider values. Ordinal numbers can be mathematically manipulated and converted back to time values, if necessary.
Note: Some time values are difficult to represent as an ordinal value, such as IMMTrackMinSecFrameTime. Such a time object produces ordinal numbers that are dependent on unknown information, such as the table of contents of a CD. Some time classes might not be able to correctly implement setTimeToOrdinal.

ordinal

      public:
      virtual unsigned long ordinal() const

  Returns an ordinal number in milliseconds. By default, this is the time converted to milliseconds. Not all derived classes can return milliseconds.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

setTimeToOrdinal

      public:
      virtual IMMTime& setTimeToOrdinal(unsigned long ordinal)

  Sets the time object to the value represented by the ordinal number in milliseconds.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### IMMTime - Enumerations

Format

      enum Format { milliseconds=1,
                    mmTime,
                    minSecFrame=5,
                    trackMinSecFrame,
                    frames=8,
                    hourMinSec,
                    bytes=11,
                    samples,
                    hourMinSecFrame,
                    mm24FramesPerSecond,
                    mm25FramesPerSecond,
                    mm30FramesPerSecond,
                    mm30FramesPerSecondDrop,
                    songpointer }

  This enumeration denotes the different allowable time formats. Valid values are as follows:

  milliseconds
    Represents the 1/1000 of a second time format.
  mmTime
    Represents the 1/3000 of a second time format.
  minSecFrame
    Represents the time format based on the 75-frames-per-second CD digital audio standard (another name for this is Redbook time format).
  trackMinSecFrame
    Represents the tracks-minutes-seconds-frames time format based on the 75-frames-per-second CD digital audio standard. This format is used primarily by CD audio devices.
  frames
    Represents the digital video frames time, where a number corresponds to a frame number.
  hourMinSec
    Represents the hours-minutes-seconds time format commonly used by videoDisc and digital video players.
  bytes
    Represents the wave audio bytes time, where a number corresponds to a byte number.
  samples
    Represents the wave audio samples time, where a number corresponds to a sample number.
  hourMinSecFrame
    Represents the hours-minutes-seconds-frames time commonly used by videoDisc and digital video players.
  mm24FramesPerSecond
    Represents the frame-numbering system developed by the Society of Motion Picture and Television Engineers that assigns a number to each frame of video based on 24 frames-per-second.
  mm25FramesPerSecond
    Represents the frame-numbering system developed by the Society of Motion Picture and Television Engineers that assigns a number to each frame of video based on 25 frames-per-second.
  mm30FramesPerSecond
    Represents the frame-numbering system developed by the Society of Motion Picture and Television Engineers that assigns a number to each frame of video based on 30 frames-per-second.
  30FramesPerSecondDrop
    Represents the frame-numbering system developed by the Society of Motion Picture and Television Engineers that assigns a number to each frame of video based on 30 frames-per-second.
  songpointer
    Represents sixteenth notes. This is the default time format for some MIDI devices.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

Windows Considerations
  The Win32 MCI subsystem does not support Universal Chinatown time (1/3000 second). Therefore, any references to the mmTime enumeration will be interpreted as milliseconds.

### IMMTime - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None