开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
UsTimezone.cpp 6.74 KB
一键复制 编辑 原始数据 按行查看 历史
timeroses 提交于 2017年10月10日 13:27 +08:00 . first vision
#include "stdafx.h"
#include "UsTimezone.h"
#include <algorithm>
/**
* 含义:每行的两个时间戳(含)之间的时间为夏令时
*/
static INT64 g_arUSTimeRange[] = {
513154800, 530690400 , //1986/4/6 2:0:0 - 1986年10月26日 1:0:0
544604400, 562140000 , //1987/4/5 2:0:0 - 1987年10月25日 1:0:0
576054000, 594194400 , //1988/4/3 2:0:0 - 1988年10月30日 1:0:0
607503600, 625644000 , //1989/4/2 2:0:0 - 1989年10月29日 1:0:0
638953200, 657093600 , //1990/4/1 2:0:0 - 1990年10月28日 1:0:0
671007600, 688543200 , //1991/4/7 2:0:0 - 1991年10月27日 1:0:0
702457200, 719992800 , //1992/4/5 2:0:0 - 1992年10月25日 1:0:0
733906800, 752047200 , //1993/4/4 2:0:0 - 1993年10月31日 1:0:0
765356400, 783496800 , //1994/4/3 2:0:0 - 1994年10月30日 1:0:0
796806000, 814946400 , //1995/4/2 2:0:0 - 1995年10月29日 1:0:0
828860400, 846396000 , //1996/4/7 2:0:0 - 1996年10月27日 1:0:0
860310000, 877845600 , //1997/4/6 2:0:0 - 1997年10月26日 1:0:0
891759600, 909295200 , //1998/4/5 2:0:0 - 1998年10月25日 1:0:0
923209200, 941349600 , //1999/4/4 2:0:0 - 1999年10月31日 1:0:0
954658800, 972799200 , //2000/4/2 2:0:0 - 2000年10月29日 1:0:0
986108400, 1004248800 , //2001/4/1 2:0:0 - 2001年10月28日 1:0:0
1018162800, 1035698400 , //2002/4/7 2:0:0 - 2002年10月27日 1:0:0
1049612400, 1067148000 , //2003/4/6 2:0:0 - 2003年10月26日 1:0:0
1081062000, 1099202400 , //2004/4/4 2:0:0 - 2004年10月31日 1:0:0
1112511600, 1130652000 , //2005/4/3 2:0:0 - 2005年10月30日 1:0:0
1143961200, 1162101600 , //2006/4/2 2:0:0 - 2006年10月29日 1:0:0
1173596400, 1194156000 , //2007/3/11 2:0:0 - 2007年11月4日 1:0:0
1205046000, 1225605600 , //2008/3/9 2:0:0 - 2008年11月2日 1:0:0
1236495600, 1257055200 , //2009/3/8 2:0:0 - 2009年11月1日 1:0:0
1268550000, 1289109600 , //2010/3/14 2:0:0 - 2010年11月7日 1:0:0
1299999600, 1320559200 , //2011/3/13 2:0:0 - 2011年11月6日 1:0:0
1331449200, 1352008800 , //2012/3/11 2:0:0 - 2012年11月4日 1:0:0
1362898800, 1383458400 , //2013/3/10 2:0:0 - 2013年11月3日 1:0:0
1394348400, 1414908000 , //2014/3/9 2:0:0 - 2014年11月2日 1:0:0
1425798000, 1446357600 , //2015/3/8 2:0:0 - 2015年11月1日 1:0:0
1457852400, 1478412000 , //2016/3/13 2:0:0 - 2016年11月6日 1:0:0
1489302000, 1509861600 , //2017/3/12 2:0:0 - 2017年11月5日 1:0:0
1520751600, 1541311200 , //2018/3/11 2:0:0 - 2018年11月4日 1:0:0
1552201200, 1572760800 , //2019/3/10 2:0:0 - 2019年11月3日 1:0:0
1583650800, 1604210400 , //2020/3/8 2:0:0 - 2020年11月1日 1:0:0
1615705200, 1636264800 , //2021/3/14 2:0:0 - 2021年11月7日 1:0:0
1647154800, 1667714400 , //2022/3/13 2:0:0 - 2022年11月6日 1:0:0
1678604400, 1699164000 , //2023/3/12 2:0:0 - 2023年11月5日 1:0:0
1710054000, 1730613600 , //2024/3/10 2:0:0 - 2024年11月3日 1:0:0
1741503600, 1762063200 , //2025/3/9 2:0:0 - 2025年11月2日 1:0:0
1772953200, 1793512800 , //2026/3/8 2:0:0 - 2026年11月1日 1:0:0
1805007600, 1825567200 , //2027/3/14 2:0:0 - 2027年11月7日 1:0:0
1836457200, 1857016800 , //2028/3/12 2:0:0 - 2028年11月5日 1:0:0
1867906800, 1888466400 , //2029/3/11 2:0:0 - 2029年11月4日 1:0:0
1899356400, 1919916000 , //2030/3/10 2:0:0 - 2030年11月3日 1:0:0
1930806000, 1951365600 , //2031/3/9 2:0:0 - 2031年11月2日 1:0:0
1962860400, 1983420000 , //2032/3/14 2:0:0 - 2032年11月7日 1:0:0
1994310000, 2014869600 , //2033/3/13 2:0:0 - 2033年11月6日 1:0:0
2025759600, 2046319200 , //2034/3/12 2:0:0 - 2034年11月5日 1:0:0
2057209200, 2077768800 , //2035/3/11 2:0:0 - 2035年11月4日 1:0:0
2088658800, 2109218400 , //2036/3/9 2:0:0 - 2036年11月2日 1:0:0
2120108400, 2140668000 , //2037/3/8 2:0:0 - 2037年11月1日 1:0:0
2152162800, 2172722400 , //2038/3/14 2:0:0 - 2038年11月7日 1:0:0
2183612400, 2204172000 , //2039/3/13 2:0:0 - 2039年11月6日 1:0:0
2215062000, 2235621600 , //2040/3/11 2:0:0 - 2040年11月4日 1:0:0
2246511600, 2267071200 , //2041/3/10 2:0:0 - 2041年11月3日 1:0:0
2277961200, 2298520800 , //2042/3/9 2:0:0 - 2042年11月2日 1:0:0
2309410800, 2329970400 , //2043/3/8 2:0:0 - 2043年11月1日 1:0:0
2341465200, 2362024800 , //2044/3/13 2:0:0 - 2044年11月6日 1:0:0
2372914800, 2393474400 , //2045/3/12 2:0:0 - 2045年11月5日 1:0:0
2404364400, 2424924000 , //2046/3/11 2:0:0 - 2046年11月4日 1:0:0
2435814000, 2456373600 , //2047/3/10 2:0:0 - 2047年11月3日 1:0:0
2467263600, 2487823200 , //2048/3/8 2:0:0 - 2048年11月1日 1:0:0
2499318000, 2519877600 , //2049/3/14 2:0:0 - 2049年11月7日 1:0:0
2530767600, 2551327200 , //2050/3/13 2:0:0 - 2050年11月6日 1:0:0
};
/**
* 含义:每行的两个时间戳(含)之间的时间为夏令时
*/
static int g_arUSYMDRange[] = {
19860406, 19861026,
19870405, 19871025,
19880403, 19881030,
19890402, 19891029,
19900401, 19901028,
19910407, 19911027,
19920405, 19921025,
19930404, 19931031,
19940403, 19941030,
19950402, 19951029,
19960407, 19961027,
19970406, 19971026,
19980405, 19981025,
19990404, 19991031,
20000402, 20001029,
20010401, 20011028,
20020407, 20021027,
20030406, 20031026,
20040404, 20041031,
20050403, 20051030,
20060402, 20061029,
20070311, 20071104,
20080309, 20081102,
20090308, 20091101,
20100314, 20101107,
20110313, 20111106,
20120311, 20121104,
20130310, 20131103,
20140309, 20141102,
20150308, 20151101,
20160313, 20161106,
20170312, 20171105,
20180311, 20181104,
20190310, 20191103,
20200308, 20201101,
20210314, 20211107,
20220313, 20221106,
20230312, 20231105,
20240310, 20241103,
20250309, 20251102,
20260308, 20261101,
20270314, 20271107,
20280312, 20281105,
20290311, 20291104,
20300310, 20301103,
20310309, 20311102,
20320314, 20321107,
20330313, 20331106,
20340312, 20341105,
20350311, 20351104,
20360309, 20361102,
20370308, 20371101,
20380314, 20381107,
20390313, 20391106,
20400311, 20401104,
20410310, 20411103,
20420309, 20421102,
20430308, 20431101,
20440313, 20441106,
20450312, 20451105,
20460311, 20461104,
20470310, 20471103,
20480308, 20481101,
20490314, 20491107,
20500313, 20501106,
};
UsTimezone::UsTimezone()
{
}
UsTimezone::~UsTimezone()
{
}
int UsTimezone::GetTimestampTimezone(int nTimestamp)
{
if ( nTimestamp < g_arUSTimeRange[0]
|| nTimestamp > g_arUSTimeRange[_countof(g_arUSTimeRange) - 1] )
{
return -5;
}
INT64 *itFind = std::lower_bound(g_arUSTimeRange, g_arUSTimeRange + _countof(g_arUSTimeRange), (INT64)nTimestamp);
int nFindIdx = int(itFind - g_arUSTimeRange);
if ( (nFindIdx % 2 == 0) && (*itFind == (INT64)nTimestamp) )
{
return -4;
}
if ( nFindIdx % 2 != 0 )
{
return -4;
}
return -5;
}
//nYear, nMonth, nDay: 日常认知的年月日
int UsTimezone::GetTMStructTimezone(int nYear, int nMonth, int nDay)
{
if ( nYear < 0 || nMonth < 0 || nDay < 0 )
return -5;
int nYMD = nYear * 10000 + nMonth * 100 + nDay;
if ( nYMD < g_arUSYMDRange[0]
|| nYMD > g_arUSYMDRange[_countof(g_arUSYMDRange) - 1] )
{
return -5;
}
int *itFind = std::lower_bound(g_arUSYMDRange, g_arUSYMDRange + _countof(g_arUSYMDRange), (int)nYMD);
int nFindIdx = int(itFind - g_arUSYMDRange);
if ( (nFindIdx % 2 == 0) && (*itFind == (int)nYMD) )
{
return -4;
}
if ( nFindIdx % 2 != 0 )
{
return -4;
}
return -5;
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/timeroses/pythoncoding.git
git@gitee.com:timeroses/pythoncoding.git
timeroses
pythoncoding
pythoncoding
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /