w***n 发帖数: 1137 | 1 看到一个程序, 里面有这么一句。
#include
#include
#include "errors.h"
typedef struct alarm_tag {
struct alarm_tag *link;
int seconds;
time_t time; /* seconds from EPOCH */
char message[64];
} alarm_t;
在主程序力有这么一句
alarm->time = time (NULL) + alarm->seconds;
以前没有见过这种用法,这句到底是什么意思? | w***n 发帖数: 1137 | 2 got it, googled this
EXAMPLES
Getting the Current Time
The following example uses the time() function to calculate the time elapsed
, in seconds, since the Epoch, localtime() to convert that value to a broken
-down time, and asctime() to convert the broken-down time values into a
printable string.
#include
#include
int main(void)
{
time_t result;
result = time(NULL);
printf("%s%ju secs since the Epoch\n",
asctime(localtime(&result)),
(uintmax_t)resu
【在 w***n 的大作中提到】 : 看到一个程序, 里面有这么一句。 : #include : #include : #include "errors.h" : typedef struct alarm_tag { : struct alarm_tag *link; : int seconds; : time_t time; /* seconds from EPOCH */ : char message[64]; : } alarm_t;
| c**o 发帖数: 166 | | c**o 发帖数: 166 | |
|