2.1.8.36 tm_to_systemtime


Description

Convert time from a TM structure to a SYSTEMTIME structure.

Syntax

void tm_to_systemtime( TM * pTM, SYSTEMTIME * pSysTime )

Parameters

pTM
[input]pointer to a TM structure
pSysTime
[modify]pointer to a SYSTEMTIME structure to receive the result.

Return

Examples

void tm_to_systemtime_Ex1()
{
    struct tm *theTime ;
    time_t aclock;
    time( &aclock );                 // Get time in seconds 
 
    theTime=localtime( &aclock );  // Convert time to struct
    
    SYSTEMTIME sysTime ;
    tm_to_systemtime(theTime ,&sysTime );
                
    printf("Now the sysTime is : %.2d-%.2d-%4d %.2d:%.2d:%.2d\n",           
    sysTime.wMonth,sysTime.wDay,sysTime.wYear,
    sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
    
}

Remark

Convert time from a TM structure to a SYSTEMTIME structure

TM:

{ int tm_sec; // seconds after the minute - [0,59]

int tm_min; // minutes after the hour - [0,59]

int tm_hour; // hours since midnight - [0,23]

int tm_mday; // day of the month - [1,31]

int tm_mon; // months since January - [0,11]

int tm_year; // years since 1900

int tm_wday; // days since Sunday - [0,6]

int tm_yday; // days since January 1 - [0,365]

int tm_isdst; // daylight savings time flag

}

SYSTEMTIME:

{

WORD wYear; // The current year.

WORD wMonth; // The current month; January is 1.

WORD wDayOfWeek; // The current day of the week; Sunday is 0, Monday is 1, and so on.

WORD wDay; // The current day of the month.

WORD wHour; // The current hour.

WORD wMinute; // The current minute.

WORD wSecond; // The current second.

WORD wMilliseconds; // The current millisecond.

}

See Also

systemtime_to_tm, convert_time_to_local

Header to Include

origin.h

Reference