dostounix
dos.h:インデックス への移動
ヘッダーファイル
dos.h
カテゴリ
日付/時刻ルーチン
プロトタイプ
long dostounix(struct date *d, struct time *t);
説明
日付と時刻を UNIX 時刻形式に変換します。
dostounix は,getdate と gettime から返される日付と時刻を UNIX 時刻形式に変換します。d は date 構造体を指し,t は有効な日時情報を含む time 構造体を指します。
日時は,1980 年 1 月 1 日 00 時 00 分 00 秒以降である必要があります。
戻り値
現在の日時パラメータを UNIX 形式(1970 年 1 月 1 日 00 時 00 分 00 秒(GMT)からの秒数)で返します。
例
#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;
}
移植性
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |