ftimeのヘルプ・マニュアル
日本語 英語
ftime --help
man ftime
FTIME(3) Linux Programmer’s Manual FTIME(3)
名前
ftime - 日付と時間を返す
書式
#include
int ftime(struct timeb *tp);
説明
この関数は現在の時刻を、紀元 (UTC 1970 年 1 月 1 日 00:00:00)からの秒数
とミリ秒数で返す。時刻は tp で返され、これは以下のように定義されている:
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
こ こ で、time は紀元 (the Epoch) からの秒数、 millitm は 紀元から time
秒後からのミリ秒数である。 timezone フィールドはグリニッジから西周り の
分で計測されるローカルタイムゾーンである(負数の場合はグリニッジからの東
回りの分を示す)。 dstflag フィールドは、もし 0 でなければ一年の一部で夏
時間が存在することを示すフラグである。
POSIX.1-2001 では、timezone と dstflag の内容は未定義である; これに頼る
のは避けること。
返り値
この関数は常に 0 を返す。 (POSIX.1-2001 仕様及びいくつかのシステムの ド
キュメントでは、エラー時に -1 を返す。)
準拠
4.2BSD, POSIX.1-2001. POSIX.1-2008 では ftime() の仕様が削除されている
。
この関数は古いものである。使ってはならない。秒単位の時間で十分 な ら 、
time(2) が 利 用 で き る 。 gettimeofday(2) でマイクロ秒が得られる。
clock_gettime(2) でナノ秒が得られるが、広く利用可能な訳ではない。
バグ
millitm フィールドは、libc4 と libc5 では正しく動作する。しかし、初期の
glibc2 ではバグがあり、常に 0 を返す。 glibc 2.1.1 から再び正常になった
。
関連項目
gettimeofday(2), time(2)
GNU 2009-03-15 FTIME(3)
FTIME(3) Linux Programmer’s Manual FTIME(3)
NAME
ftime - return date and time
SYNOPSIS
#include
int ftime(struct timeb *tp);
DESCRIPTION
This function returns the current time, in seconds and milliseconds
since the Epoch (00:00:00 UTC, 1 January 1970). The time is returned
in tp, which is declared as follows:
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
Here time is the number of seconds since the Epoch, and millitm is the
number of milliseconds since time seconds since the Epoch. The time-
zone field is the local timezone measured in minutes of time west of
Greenwich (with a negative value indicating minutes east of Greenwich).
The dstflag field is a flag that, if non-zero, indicates that Daylight
Saving time applies locally during the appropriate part of the year.
POSIX.1-2001 says that the contents of the timezone and dstflag fields
are unspecified; avoid relying on them.
RETURN VALUE
This function always returns 0. (POSIX.1-2001 specifies, and some sys-
tems document, a -1 error return.)
CONFORMING TO
4.2BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of
ftime().
This function is obsolete. Don’t use it. If the time in seconds suf-
fices, time(2) can be used; gettimeofday(2) gives microseconds;
clock_gettime(2) gives nanoseconds but is not as widely available.
BUGS
Under libc4 and libc5 the millitm field is meaningful. But early
glibc2 is buggy and returns 0 there; glibc 2.1.1 is correct again.
SEE ALSO
gettimeofday(2), time(2)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2009-03-15 FTIME(3)