Truxton media get expires

From truxwiki.com
Revision as of 14:57, 3 November 2020 by Sam (talk | contribs)
Jump to navigation Jump to search

This retrieves the expiration date of the media. This corresponds to the [Expires] column of the [Media] table. This is the date that the media will be automatically deleted from Truxton. By default, it is 99 years from the creation date.

Syntax

uint64_t truxton_media_get_expires( uint64_t media_handle );

Parameters

media_handle

The handle created by the truxton_media_open_id or truxton_media_create call.

Return value

The expiration date of the media in FILETIME ticks.

Sample

void is_expired(uint64_t media)
{
   FILETIME now;

   GetSystemTimeAsFileTime(&now);

   ULARGE_INTEGER ticks;

   ticks.LowPart = now.dwLowDateTime;
   ticks.HighPart = now.dwHighDateTime;

   uint64_t expiration_date = truxton_media_get_expires(media);

   if ( ticks.QuadPart() >= expiration_date )
   {
      printf( "The media has expired\n" );
   }
   else
   {
      printf( "The media has not yet expired\n" );
   }
}