1

RWTime が 1 時間延長する理由

#include <rw/rwtime.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>

main(){
 RWTime t;   // Current time
 RWTime d(RWTime::beginDST(1990, RWZone::local()));
   cout << "Current time:         " << RWDate(t) << " " << t <<
            endl;
   cout << "Start of DST, 1990:   " << RWDate(d) << " " << d <<
           endl;
}

上記のプログラムは次のように出力します:

root@otp42mas:/home/nmsadm/sapna/cProgS# ./a.out
Current time: 10/27/10 10/27/10 17:08:06
Start of DST, 1990: 04/01/90 04/01/90 03:00:00

しかし、date与えます:

root@otp42mas:/home/nmsadm/sapna/cProgS# date
Wed Oct 27 16:08:10 IST 2010

4

2 に答える 2

1

第六感がチクチクして、その答えは夏時間に関係しているのだと教えてくれます...理由はわかりませんが...

于 2010-10-27T11:02:38.477 に答える
0

デフォルトでRWZone::local()は、北米のDST遷移に基づいてRWZone実装が返されます。RWZone::os()現在のシステムタイムゾーンから派生したRWZone実装ベースのDST遷移を提供します。RWZone::local()以下を使用して使用するように更新できますRWZone::os()

RWZone::local(&RWZone::os());
于 2011-12-03T03:44:22.800 に答える