IWMSDataContainerVersion::SetExpirationTime

banner art

Previous Next

IWMSDataContainerVersion::SetExpirationTime

The SetExpirationTime method specifies the content expiration date.

Syntax

  HRESULT SetExpirationTime(
  DATE  dateExpirationTime
);

Parameters

dateExpirationTime

[in] DATE containing the content expiration. The DATE type is implemented using an 8-byte floating point number. Days are represented by whole number increments starting with midnight on 30 December 1899 as time zero. Hour values are expressed as the absolute value of the fractional part of a day. This is illustrated in the following table.

Date Value
30 December 1899, midnight 0.00
30 December 1899, noon 0.50
1 January 1900, midnight 2.00
4 January 1900, midnight 5.00
4 January 1900, 6 A.M. 5.25
4 January 1900, noon 5.50
4 January 1900, 9 P.M. 5.875

Return Values

If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.

Remarks

When content is downloaded, an expiration date must be associated with it. The date is specified by the origin sever to indicate the time at which content can no longer be considered current. A cache proxy plug-in must check the date to determine whether the content has expired. If it has, the plug-in must call IWMSCacheProxyServerCallback::OnCompareContentInformation so that the cache server can retrieve content information from the origin server and compare it to information about the cached content. If it has not expired, the plug-in can direct the server to stream the content to a client.

Example Code

The following example specifies a date that never effectively expires.

// Define the expiration date.
#define DBL_MAX         1.7976931348623158e+308

// Define variables.
HRESULT hr = S_OK;
IWMSDataContainerVersion *pVersion = NULL;

// Use a pointer to an IWMSClassObject interface, pClassFactory,
// to create an IWMSDataContainerVersion object.
hr = pClassFactory->CreateInstance( IID_IWMSDataContainerVersion,
                                    (void **) &pVersion );
if (FAILED(hr)) goto EXIT;

// Specify the expiration date.
hr = pVersion->SetExpirationTime( (double) DBL_MAX );
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary objects.

Requirements

Header: datacontainerversion.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next