PHP 时间戳与日期32位系统下超限问题(1970--2038)

江科大笔记—Unix时间戳 原子钟是当前计时最精确的装置,上千万年才误差一秒,那现在问题又来了,我们以一个恒定不变的秒来计时,但是地球自转越来越慢,这样记下去,计时的一天和自转的一天就会出现偏差,时间长一些,可能中午12点太阳就不是最高的位置。stlink上再引出一根3.3v的电源,接到VBAT引脚,这根线就模拟一个电池的电源一般情况下,VBAT是电池供电口需要接备用电池但是我们目前套件里没有电池,所以就直接引出一根3.3v电源线了也是一样的效果,这个程序的目的是在bkp备份进器写入两个数据,然后再把它们读出来显示一下。 阅读详情
//1、时间戳转日期格式
function timestampToDate($timestamp) {
    $datetime = new DateTime("@$unixtime");
    $datetime->setTimezone(new DateTimeZone('PRC'));
    return $datetime->format("Y-m-d H:i:s");
}
 
//2、日期格式转时间戳
function dateToTimestamp($date) {
    $datetime= new DateTime($date, new DateTimeZone('PRC'));
    return $datetime->format('U');
}

 

在昇腾910B服务上部署搭建适配PDF解析工具Mineru2.5开源项目 本文介绍了在昇腾910B服务器上部署开源PDF解析工具Mineru2.5的过程。首先从昇腾社区下载mindie镜像并运行容器,安装系统依赖。针对部署过程中遇到的多个报错问题(如torchvision与torch版本不匹配、昇腾软件栈与NumPy 2.0不兼容等),提供了具体解决方案和兼容版本。通过设置环境变量、安装指定版本的Python依赖包,成功部署Mineru项目并下载模型。最后运行测试,验证了在NPU设备上运行pipeline的可行性。整个过程详细记录了版本适配和错误处理方法,为类似部署场景提供了参考 阅读详情

相关推荐

【SABRE 3D, SABRE 3DxT,LAM设备】2025年9月12日-生产期间维护用的双重隔离

生产期间维护用的双重隔离。该程序用于准备将一个或多个双工位设置为维护状态,同时SABRE 3D/3DxT/3D Scimitar保持生产运行。其目的是在不中断生产的情况下将双工位与运行中的设备隔离。

weixin_46735260的博客 573

php时间戳知识点,php 时间戳函数总结与示例

一,PHP时间戳函数获取指定日期的unix时间戳strtotime(”2009-1-22″)示例:复制代码 代码示例:echo strtotime(”2009-1-22″) 结果:1232553600说明:返回2009年1月22日0点0分0秒时间戳二,PHP时间戳函数获取英文文本日期时间示例如下:便于比较,使用date将当时间戳与指定时间戳转换成系统时间(1)打印明天此时的时间戳strtotime...

weixin_26851099的博客 282

从STM32F411到华大HC32F460:一个真实项目移植的踩坑与填坑全记录

本文详细记录了从STM32F411移植到华大HC32F460芯片的全过程,包括开发环境搭建、时钟树配置、中断处理、外设驱动、看门狗陷阱、Flash操作和低功耗设计等关键坑点及解决方案。特别针对HC32F460的200MHz主频、双PLL架构和HSRUN模式等特性进行了深入分析,为工程师提供实用的移植指南,帮助节省大量调试时间。

weixin_33691817的博客 418

PHP/MySQL 关于时间函数、时间戳,时间范围

mktime() 函数返回日期的 Unix 时间戳。Unix 时间戳包含 Unix 纪元(1970 年 1 月 1 日 00:00:00 GMT)与指定时间之间的秒数。 mktime(hour,minute,second,month,day,year) <?php $d=mktime(9, 12, 31, 6, 10, 2015); echo "创建日期是 " . date("Y-m-d h:i:sa", $d); ?> PHP strtotime() 函数用于把人类可读的字符串转换为 Uni

weixin_47277903的博客 630

【C++】C++异常语法、使用、规范、异常安全及异常的优缺点

实际中我们可以可以去继承exception类实现自己的异常类。但是实际中很多公司像上面一样自己定义一套异常继承体系。因为C++标准库设计的不够好用。如果有一个块抛出一个异常,捕获异常的方法会使用 try 和 catch 关键字。try 块中放置可能抛出异常的代码,try 块中的代码被称为保护代码。C++ 提供了一系列标准的异常,定义在 中,我们可以在程序中使用这些标准的异常。异常是一种处理错误的方式,

weixin_51692487的博客 1523

手把手教你搭建幽冥传奇手游:从环境配置到常见Bug修复(附完整避坑指南)

本文详细指导如何从零搭建幽冥传奇手游,涵盖服务器选型、数据库部署、双区架构配置等关键步骤,并提供通天塔闪退、技能显示异常等常见Bug的修复方案。附完整避坑指南,帮助开发者高效解决90%的典型问题,确保游戏稳定运行。

weixin_29232121的博客 240

1970年1月1日,这是编程语言和数据库开始记时日

编程语言和数据库开始记时现在大多数操作系统都是32位的 32位最大值是2的32次方减一,也就是说这个数字是2147483647 ,一年有 365天的总秒数为31536000,所以计算机的计时周期是 2147483647/31536000=68.1年。32位操作系统能表示的最长时间是68.1年而实际上到2038年01月19日03时14分07秒就会到达最大时间点。32位的时间会变成10000000 0

fengren_520的专栏 1306

SAP MM采购合同创建全解析:ME31K操作与后台逻辑

在SAP ERP的物料管理模块中,采购合同作为框架协议的核心,定义了企业与供应商之间的长期供货关系。它与采购订单不同,合同不直接产生收货或发票,而是为后续采购订单提供数据源。创建合同(事务码ME31K)时,需要区分数量合同与金额合同,并维护抬头、行项目、有效期、价格条件和税码等关键信息。SAP通过源确定机制在创建采购订单时自动匹配合同,同时审批策略、编码范围和输出类型也会影响合同的实际可用性。掌握合同创建逻辑,能有效解决采购订单无法带出合同、审批未触发、价格缺失等高频问题。从ME31K实操出发,系统梳理采购

weixin_30000735的博客 195

64位时间戳 php,32 位 PHP 时间戳问题

今天遇到一个bug,strtotime('2099-12-12 00:00:00')的时候返回false。排查之后发现,是32位的unix时间戳漏洞,称为Y2K38 漏洞。(64位PHP的不受此影响)Y2K38 漏洞Y2K38,又称 Unix Millennium Bug,此漏洞将会影响到所有 32 位系统下用 UNIX 时间戳整数来记录时间的 PHP,及其它编程语言。一个整型的变量所能保存的最大...

weixin_39612877的博客 700

【20230415】Ubuntu22.04双屏显示触屏设置,解决触摸点和响应位置不一致的问题

双屏显示时,如果存在一个触摸屏,有可能会出现触摸点和响应位置不一致的问题。我的显示器配置如下:一个34寸,3440*1440;一个22英寸触摸屏,1920*1080。

Creationyang的博客 3213

Open-Sora代码详细解读(2):时空3D VAE

目前开源的DiT视频生成模型不是很多,Open-Sora是开发者生态最好的一个,涵盖了DiT、时空DiT、3D VAE、Rectified Flow、因果卷积等Diffusion视频生成的经典知识点。本篇博客从Open-Sora的代码出发,深入解读背后的原理。

沉迷单车的追风少年 2052

PHP 解决时间戳冲突,php 时间超出2038年 转化时间戳失败的解决方案

PHP有效的时间戳典型范围是格林威治时间 1901 年 12 月 13 日 20:45:54 到 2038 年 1 月 19 日03:14:07。在32位操作系统环境下,超出2038年之后,使用strtotime()获取不到对应的时间戳,这时可以使用new DateTime来进行处理。即先将时间转化为DateTime对象,然后使用format方法进行转化。即:$datetime->fo...

weixin_33049919的博客 775

PCL K4PCS算法实现点云粗配准【2026最新版】

K4PCS算法实现点云粗配准。博客长期更新,本文最近一次更新时间为:2026年5月4日。

点云侠的博客 42万+

神奇的时间戳

时间戳的小故事 1969年8月,贝尔实验室的程序员肯汤普逊利用妻儿离开一个月的机会,开始着手创造一个全新的革命性的操作系统,他使用B编译语言在老旧的PDP-7机器上开发出了Unix的一个版本。随后,汤普逊和同事丹尼斯里奇改进了B语言,开发出了C语言,重写了UNIX,新版于1971年发布。 那时的计算机操作系统是32位,时间用32位有符号数表示,则可表示 68 年, 用32位无符号数表示,可表示13...

Missingrakan的博客 2511

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

原来是传说中的2038问题

  在若日历时间存放在带符号的3 2位整型数中,那么到哪一年它将溢出?            32位有符号整数,其实真正有用的只有31位,所以可以存储的时间是2^31秒,那么是多少年了,可以用如下公式   粗略计算!   y = 2^31/(365*24*60*60) (约)= 68! 而linux下时间是从1970开始的,所以到2038(1970+68)年,时间将会溢出!  在计算机应用

狂客队长 5269

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

时间戳2038问题是什么?如何解决这个问题?底层原理是什么?

超过这个时间戳的计算机系统将无法正确处理日期和时间。它指的是在2038年1月19日03:14:07 UTC之后,使用32位带符号整数来表示时间戳的计算机系统将无法正确处理日期和时间,从而导致系统错误或崩溃。3.使用其他时间表示方式:例如,使用字符串表示时间戳,使用浮点数表示秒数等方式,可以避免时间戳2038问题,但需要修改应用程序来支持新的时间表示方式。1.使用64位时间戳:使用64位整数来表示时间戳,可以解决时间戳2038问题,但需要修改操作系统和应用程序来支持64位时间戳。

长风破浪会有时的博客 7249

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

关于32位计数器溢出问题

好久没写博客了,昨天遇到一个时间计数溢出问题, 做个简单记录吧 背景:底层提供一个unsigned int的变量表示自开机以来累计时间,用作码流的时间戳,单位ms. 问题:32位无符号数的毫秒计数,大概49天就会溢出,溢出后时间计数用作时间戳就会出错,导致无法正确解码。 为解决这一问题,用一个64位变量来保存累计时间, 方法如下:

科学边界 7133

解决mktime在32位的机子上溢出的问题

在32位的机子上,time_t是个4字节的值,存储的是1900年到现在的秒数,最大可存放的秒数(时间戳)到2038年多,设置的tm_year不能超过138,多了会溢出,返回异常值。 解决方法: 修改mktime函数的返回值类型 unsigned long -> unsigned long long unsigned long long my_mktime(const unsigned int year0, const unsigned int mon0, const unsign

dongyoubin的博客 2021

MyBatis的2038年问题的讨论

建议优先采用升级框架版本+数据库类型调整的组合方案,在最小改动成本下获得最大兼容性提升。对于无法立即升级的系统,可通过强制使用字符串时间格式作为临时过渡方案。

ma451152002的专栏 535

变长的时间戳(第4版)

每400年有400×365+97=146097天,A类时间戳能表达1000个400年,是40万年,公元前后各20万年。1×××× 1×××× 0××××,这表示有3个32位。第2位是0,再看第3位,是0,就是A类;C类时间戳的单位是皮秒,写成A+B+C的形式,能表达很精细的时间。B类时间戳的单位是毫秒,和A类时间戳一起使用,满足多数需求。A类时间戳的单位是天,可以只有它自己,表示精确到天的时间;以32位为单位,一个时间戳可以是32位、64位、96位。B类时间戳表示一天中的毫秒数,它也可以储存于29比特中。

proorck2019的博客 667

Unix 时间戳2038年问题到底是什么意思?为什么会存在这个问题?底层原理是什么?

具体来说,在2038年1月19日星期二03:14:07 UTC之后的一秒钟,即时间戳达到2,147,483,647 (+2^31 - 1),下一个秒将变为-2,147,483,648 (-(2^31)),导致时间和日期突然跳回到1901年12月13日星期五20:45:52 UTC。在许多系统中,这个时间戳通常被存储为一个有符号的32位整数。Unix时间戳2038年问题(也被称为“2038年问题”或“Year 2038 problem”)指的是当这个32位整数达到它的最大值时会发生溢出的问题。

长风破浪会有时的博客 1968

为什么编程时间从1970年1月1日开始?

最初计算机操作系统是32位,而时间也是用32位表示。 System.out.println(Integer.MAX_VALUE); 2147483647 Integer在JAVA内用32位表示,因此32位能表示的最大值是2147483647。另外1年365天的总秒数是31536000, 2147483647/31536000 = 68.1 也就是说32位能表示的最长时间是68年,而实际上

沐浴星光的少年的博客 1027

32位linux时间戳,32位unix时间戳哪一年用尽

我这里有一个日志logtimelogtime日志内容:1255723142|NONE|CCVST|SIP/2324|UNPAUSE|1255723142|NONE|CCGST|SIP/2324|UNPAUSE|1255723203|NONE|CCISO|SIP/2324|UNPAUSE|1255723203|NONE|CCVST|SIP/2324|UNPAUSE|1255723203|NONE|C...

weixin_42502545的博客 1194

时间戳过了2038年以后不能用了怎么办?

如何解决程序员面临的时间戳2038的问题?当2038年过后,时间戳无法继续使用怎么办?strtotime date都相继失效,代码还能跑吗? 别急 还有这个 运行结果 还能再坚持一段时间,哈哈哈...

weixin_34148456的博客 1万+

PHP下Unix时间戳与日期互转(解决1970年前及2038年后问题)

这个问题主要在32位的系统下出现,64位的不存在这样的问题。php 5.2+提供了DateTime类来处理这样的问题,参考方案如下(请注意时区的处理)://1、Unix时间戳转日期function unixtime_to_date($unixtime, $timezone = 'PRC') { $datetime = new DateTime("@$unixtime"); //DateTi

x64asm 2596

PHP时间戳

PHP时间戳 UNIX 时间戳(timestamp)是 PHP 中关于时间日期一个很重要的概念,它表示从 1970年1月1日 00:00:00 到当前时间的秒数之和。 PHP提供了内置函数 time() 来取得服务器当前时间的时间戳。 例如: <?php echo time(); ?> 上面的例子运行后得到的是一串类似这样的数字:1279115455 我们可以通过 date() 等函数将它格式化为我们需要的时间日期格式。 有效的时间戳典型范围是格林威治时间 1901年12月13日 20:

weixin_45820444的博客 1万+
上一篇: php json_encode()与json_decode()数组、对象、字符串互相转换
下一篇: linux下配置lamp项目目录修改问题
阿……莫西林
博客等级 码龄9年 42粉丝 111原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值