• systemtime转换成timeb


    相关函数:time, ctime, gettimeofday
    表头文件:#include <sys/timeb.h>
    函数定义:int ftime(struct timeb *tp);
    函数说明:ftime()将目前日期由tp所指的结构返回。tp结构定义:

    struct   timeb{
           time_t   time;                      /* 为1970-01-01至今的秒数*/
           unsigned   short   millitm;       /*   千分之一秒 */
           short   timezonel;                  /* 为目前时区和Greenwich相差的时间,单位为分钟 */
           short   dstflag;                     /* 为日光节约时间的修正状态,如果为非0代表启用日光节约时间修正 */
    };

    返回值 :无论成功或失败都返回0
    FILETIME ft;
     SYSTEMTIME st;
     GetLocalTime(&st);
     SystemTimeToFileTime( &st, &ft );
     LONGLONG ll;
     ULARGE_INTEGER ui;
     ui.LowPart = ft.dwLowDateTime;
     ui.HighPart = ft.dwHighDateTime;
     ll = (ft.dwHighDateTime << 32) + ft.dwLowDateTime;
     _Tmb->time = (DWORD)((LONGLONG)(ui.QuadPart - 116444736000000000) / 10000000);//获取systemtime转换成   time_t   time;  /* 为1970-01-01至今的秒数*/

        _Tmb->millitm=st.wMilliseconds;//获取systemtime转换成 /*   千分之一秒 */
  • 相关阅读:
    C++ 17
    C++ 11
    mysql统计某一个数据库中有几张表
    poj2636---Electrical Outlets(插线板)
    poj2608---几个字母映射到同一个数字
    poj2583---Series Determination
    poj2578---三个数中找出第一个大于168的
    poj2521---lose money
    poj2538---字符匹配(映射)
    poj2509---抽k根烟就换一支,求能抽烟的总数
  • 原文地址:https://www.cnblogs.com/jhabb/p/2015903.html
Copyright © 2020-2023  润新知