稳定时钟的时间是否与操作系统启动的时间有关?还是过程本身? [英] Is the epoch of steady_clock relative to when the operating system starts? or to the process itself?

查看:80
本文介绍了稳定时钟的时间是否与操作系统启动的时间有关?还是过程本身?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 boost :: chrono :: steady_clock std :: chrono :: steady_clock 是为了确保物理时间始终单调且不受日期时间影响系统的变化.这是我的问题,如果我有两个进程需要不受系统日期时间更改的影响,那么仅交换 time_since_epoch 就足够了吗?换句话说,自一个时期以来,两个过程到同一时间的时间解释是相同的吗?具体来说,我需要针对Windows和QNX回答这个问题.

Using boost::chrono::steady_clock or std::chrono::steady_clock is suppose to guarantee that physical time is always monotonic and is not affected by date time changes in the system. Here is my question, if I have two processes that need to be immune to system date time changes, is it enough to exchange just the time_since_epoch? In other words, the time interpretation of the two processes to the same time since epoch will be the same? Specifically I need to answer this question for Windows and QNX.

两个进程都在同一台计算机,同一操作系统中运行,并通过IPC调用进行通信.

Both processes are running in the same computer, same operating system and communicate via IPC calls.

推荐答案

没有时间在系统之间是不可互换的,因为C ++没有指定时代.时代取决于操作系统,不同的系统可以具有不同的时代.

No the times are not interchangeable between systems, because C++ doesn't specify the epoch. The epoch is depending on the operating system, different systems can have different epochs.

另一方面,如果您仅在同一系统内本地共享时间,那么就可以了.

If, on the other hand, you share the times only locally, within the same system, then it's okay.

这篇关于稳定时钟的时间是否与操作系统启动的时间有关?还是过程本身?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆