请输入您要查询的百科知识:

 

词条 gettimeofday
释义

(PHP 3 >= 3.0.7, PHP 4, PHP 5)

gettimeofday -- 取得当前时间(保存在结构体timeval中)

函数原型:int gettimeofday(struct timeval *tv, struct timezone *tz);

说明

mixed gettimeofday ( [bool return_float] )

本函数是 gettimeofday(2) 的接口。返回一个关联数组,包含有系统调用返回的数据。

自 PHP 5.1.0 起有个可选参数 return_float,当其设为 TRUE 时,gettimeofday() 会返回一个浮点数。

数组中的键为:

"sec" - 自 Unix 纪元起的秒数

"usec" - 微秒数

"minuteswest" - 格林威治向西的分钟数

"dsttime" - 夏令时修正的类型

例子 1. gettimeofday() example

<?php

print_r(gettimeofday());

echo gettimeofday(true);

?>

上例的输出类似于:

Array

(

[sec] => 1073504408

[usec] => 238215

[minuteswest] => 0

[dsttime] => 1

)

1073504408. 238215

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/2 0:39:17