3

この質問が StackOverflow に属しているかどうかはわかりませんが、ここにあります。

あるパーティから別のパーティに転送されるデータのタイムスタンプを C# を使用して生成する必要があり、すべてのオペレーティング システム (Windows、Linux、および Unix) におけるシステム クロックの最悪のケースの精度を知る必要がありますか? 私が必要としているのは、すべてのオペレーティング システムがこのタイムスタンプを検証できるように精度を把握することです。

たとえば、Windows Vista オペレーティング システムのクロックの分解能は約 10 ~ 15 ミリ秒です。

4

2 に答える 2

1

Are you looking to generate something like a unix timestamp for the data? Or to find a timestamp that wont collide with an existing file? If its the later you could always use ticks.

The problem with any "long" timestamp is that it will be relative to the machine generating it but wont guarantee non-collision on the other system, as the clocks can be set differently (not float, but actually be set differently).

If the data is secure/sensitive and you are looking at a time-based mechanism for sync-ing keys (ALA Kerberos) I would not suggest rolling your own as there are many obstacles to overcome especially in sync-ing systems and keeping them in sync.

于 2009-12-19T03:36:18.113 に答える
0

面白い。主要なオペレーティング システムの解像度は、最悪でもセンチ秒 (0.01 秒) ですが、多くの場合、より高い精度で組み込まれています。

man utimeLinux は、コンピューターのクロック ハードウェアに応じて、タイムスタンプ (「参考文献」を参照) で最大マイクロ秒の分解能を提供します。Windows NT/Win2K/XPなど すべてのシステム タイムスタンプを0.000 000 1秒単位 (1 秒あたり 1,000 万) で説明しますが、ファイルのタイムスタンプでミリ秒の精度を提供します (NTFS のみを使用)。

システム間で正確正確な時間分解能が必要な場合、GPS 受信機は動作の副作用として 100 ナノ秒の精度を簡単に達成できます。 特別な GPS モデルにより、導出された時間が外部で使用できるようになります。

于 2009-12-19T04:16:07.143 に答える