dostounix
Remonter à Dos.h - Index
Header File
dos.h
Category
Time and Date Routines
Prototype
long dostounix(struct date *d, struct time *t);
Description
Converts date and time to UNIX time format.
dostounix converts a date and time as returned from getdate and gettime into UNIX time format. d points to a date structure, and t points to a time structure containing valid date and time information.
The date and time must not be earlier than or equal to Jan 1 1980 00:00:00.
Return Value
Returns UNIX version of current date and time parameters: number of seconds since 00:00:00 on January 1, 1970 (GMT).
Example
#include <time.h>
#include <stddef.h>
#include <dos.h>
#include <stdio.h>
int main(void)
{
time_t t;
struct time d_time;
struct date d_date;
struct tm *local;
getdate(&d_date);
gettime(&d_time);
t = dostounix(&d_date, &d_time);
local = localtime(&t);
printf("Time and Date: %s\n", asctime(local));
return 0;
}
Portability
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |