⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptime.h

📁 PTypes (C++ Portable Types Library) is a simple alternative to the STL that includes multithreading
💻 H
字号:
/* * *  C++ Portable Types Library (PTypes) *  Version 1.7.5   Released 9-Mar-2003 * *  Copyright (c) 2001, 2002, 2003 Hovik Melikyan * *  http://www.melikyan.com/ptypes/ *  http://ptypes.sourceforge.net/ * */#ifndef __PTIME_H__#define __PTIME_H__#ifndef __PPORT_H__#include "pport.h"#endif#ifndef __PTYPES_H__#include "ptypes.h"#endif#include <time.h>PTYPES_BEGINtypedef large datetime;             // datetime type: 64-bit, number of milliseconds since midnight 01/01/0001const int msecsmax = 86400000;      // number of milliseconds in one dayconst int daysmax = 3652059;        // number of days between 01/01/0001 and 12/31/9999const datetime datetimemax = large(msecsmax) * daysmax;    // max. allowed number for datetime typeconst datetime invdatetime = large(-1);// datetime general utilitiesinline int days(datetime d)            { return int(d / msecsmax); }inline int msecs(datetime d)           { return int(d % msecsmax); }ptpublic datetime mkdt(int days, int msecs);ptpublic bool     isvalid(datetime);ptpublic datetime now(bool utc = true);ptpublic void     tzupdate();ptpublic int      tzoffset();ptpublic string   dttostring(datetime, const char* fmt);ptpublic string   nowstring(const char* fmt, bool utc = true);ptpublic datetime utodatetime(time_t u);// date/calendar manipulationptpublic bool     isleapyear(int year);ptpublic int      daysinmonth(int year, int month);ptpublic int      daysinyear(int year, int month);ptpublic int      dayofweek(datetime);ptpublic bool     isdatevalid(int year, int month, int day);ptpublic datetime encodedate(int year, int month, int day);ptpublic bool     decodedate(datetime, int& year, int& month, int& day);// time manipulationptpublic bool     istimevalid(int hour, int min, int sec, int msec = 0);ptpublic datetime encodetime(int hour, int min, int sec, int msec = 0);ptpublic bool     decodetime(datetime, int& hour, int& min, int& sec, int& msec);ptpublic bool     decodetime(datetime, int& hour, int& min, int& sec);PTYPES_END#endif // __PTIME_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -