zoukankan      html  css  js  c++  java
  • time函数

     1 相关内容来自鱼c论坛https://fishc.com.cn/forum.php?mod=viewthread&tid=84364&extra=page%3D2%26filter%3Dtypeid%26typeid%3D583
     2 
     3 time函数:time 函数用于返回从标准计时点到当前时间的秒数,即从 197011 日的 UTC 时间 000 秒算起到现在所经过的秒数。
     4 参数:time_t 含义:
     5              1. 一个指向 time_t 类型变量的指针,用于存放获得的结果
     6              2. 可以将该参数指定为 NULL,通过函数的返回值获得结果
     7 返回值:如果函数调用成功,返回值是标准计时点到当前时间所经过的秒数;
     8        如果函数调用失败,返回值是 -1,并设置 errno。
     9 头文件:<time.h>
    10 代码:
    11 #include <stdio.h>
    12 #include <time.h>
    13 
    14 int main(void)
    15 {
    16         time_t seconds;
    17 
    18         // 下面语句也可以写成:time(&seconds);
    19         seconds = time(NULL);
    20 
    21         printf("1970年1月1日零点到现在经过了%ld个小时!\n", seconds / 3600);
    22 
    23         return 0;
    24 }
  • 相关阅读:
    在Intellij idea 2017中运行tomcat 8.5
    Servlet技术之服务器的安装和配置
    Servlet&&Jsp 概述
    linux 下 tomcat 安装
    执行数据库的更新操作
    JDBC
    Mysql 命令
    hdoj2036 改革春风吹满地——叉积
    常规设置
    pytorch本地安装
  • 原文地址:https://www.cnblogs.com/ZhengLijie/p/12491423.html
Copyright © 2011-2022 走看看