1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
   | typedef struct _tm
{
   BYTE    tm_sec;    // Seconds [0-60]
   BYTE    tm_min;    // Minutes [0-59]
   BYTE    tm_hour;   // Hours [0-23]
   BYTE    tm_mday;   // Day [1-31]
   BYTE    tm_mon;    // Month [0-11]
   int     tm_year;   // Year
   BYTE    tm_wday;   // Day of Week [0-6], 0 = Sunday
   int     tm_yday;   // Day of year [0-365]
} tm;
 
 
 
There is a function that takes a timer counter value (type time_t) and
converts it filling up each of the elements of a tm structure.
 
Let me give you an example that will be more clear.
 
  time_t local_time;                     // define a time_t type variable  
  tm tm_time;                             // define a variable to hold the structure
  ....
  ....
  local_time = GetTimeTick();        // Get the current time seconds counter
  offtime( &tm, local_time, 0);       // generate the tm structre based on the 
                                               // seconds counter, you can use the third
                                               // argument to add an offset
 
 
 
After that code is executed, now for example tm->tm_hour will have the
hours, tm->tm_min the minutes, etc. | 
Partager