Closed
Bug 480636
Opened 16 years ago
Closed 16 years ago
Create Porting APIs for date and time functionality
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tamarin Graveyard
Virtual Machine
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: rishah, Unassigned)
References
Details
Attachments
(1 file, 1 obsolete file)
41.47 KB,
patch
|
lhansen
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6
Build Identifier:
Add VMPI APIs for date and time functions used by Tamarin. The existing platform specific implementations in Date[platform].cpp and OSDep[platform].cpp files should be abstracted and their implementations moved to the platform porting layer
Reproducible: Always
Reporter | ||
Comment 1•16 years ago
|
||
Summary -
New APIs - VMPI_getTime, VMPI_getDate, VMPI_getLocalTimeOffset, VMPI_isTimeDST
Platform implementations of these APIs added to [Win/Posix]PortUtils.cpp
OSDep[Win/Mac/Unix].cpp goes away.
Attachment #365073 -
Flags: review?(lhansen)
Reporter | ||
Updated•16 years ago
|
Attachment #365073 -
Flags: review?(stejohns)
Comment 2•16 years ago
|
||
VMPI_getTimeMs would possibly be more expressive (certainly closer to current code) than VMPI_getTime, but it's only a mild preference; your chosen name reads better.
Assuming that the DST offset is one hour is presumably a bug that's carried over from existing code, but it is a bug. According to the Wikipedia's article on Daylight Savings Time, "A one-hour shift is customary, but Australia's Lord Howe Island uses a half-hour shift.[86] Twenty-minute and two-hour shifts have been used in the past." Consequently, I think that there should be another porting interface here (probably VMPI_DaylightSavingsTA), the comments should note that always assuming one hour is not correct and suggest looking for an OS API to provide the correct adjustment. (Am I tilting at windmills? Steven?)
Updated•16 years ago
|
Attachment #365073 -
Flags: review?(lhansen) → review+
Comment 3•16 years ago
|
||
Newfoundland uses 1/2hr shift! IIRC some of the islands in the south pacific also rely on < 1hr offset.
Reporter | ||
Comment 4•16 years ago
|
||
(In reply to comment #2)
> VMPI_getTimeMs would possibly be more expressive (certainly closer to current
> code) than VMPI_getTime, but it's only a mild preference; your chosen name
> reads better.
Original name I gave was getTimeMilliseconds but that felt too long. Also, wanted to avoid abbreviations in API names (though I already violated in isTimeDST) and then decided upon keeping in simple and readable.
> Assuming that the DST offset is one hour is presumably a bug that's carried
> over from existing code, but it is a bug. According to the Wikipedia's article
> on Daylight Savings Time, "A one-hour shift is customary, but Australia's Lord
> Howe Island uses a half-hour shift.[86] Twenty-minute and two-hour shifts have
> been used in the past." Consequently, I think that there should be another
> porting interface here (probably VMPI_DaylightSavingsTA), the comments should
> note that always assuming one hour is not correct and suggest looking for an OS
> API to provide the correct adjustment. (Am I tilting at windmills? Steven?)
I'll change the API and add comments to that respect.
Comment 5•16 years ago
|
||
(In reply to comment #4)
> (In reply to comment #2)
> Original name I gave was getTimeMilliseconds but that felt too long. Also,
> wanted to avoid abbreviations in API names (though I already violated in
> isTimeDST) and then decided upon keeping in simple and readable.
Avoiding abbreviations is a good goal, but only where meaning is clear without it. isTimeDST is a necessary evil IMHO.
Comment 6•16 years ago
|
||
Comment on attachment 365073 [details] [diff] [review]
Patch [v1] - date and time APIs
Approved assuming we fix the DST=1-hour assumption.
nit: there are a few uint64 that should probably be uint64_t.
question: there is a naked call to VMPI_getDate() in Assembler::nInit that ignores the result... what's up with that? (The call predates this change)
Attachment #365073 -
Flags: review?(stejohns) → review+
Reporter | ||
Comment 7•16 years ago
|
||
(In reply to comment #6)
> (From update of attachment 365073 [details] [diff] [review])
> Approved assuming we fix the DST=1-hour assumption.
Will fix this.
> nit: there are a few uint64 that should probably be uint64_t.
the uint64 types were already in existing code. I didn't want to change them to uint64_t because that could introduce warnings/errors for RVCT compilers for assignment code at other locations. Addressing those warnings was out-of-scope of this bug.
> question: there is a naked call to VMPI_getDate() in Assembler::nInit that
> ignores the result... what's up with that? (The call predates this change)
I noticed that too and that call looks useless.
Comment 8•16 years ago
|
||
>> question: there is a naked call to VMPI_getDate() in Assembler::nInit that
>> ignores the result... what's up with that? (The call predates this change)
> I noticed that too and that call looks useless.
Remove it; IIRC its a vestige from when we were doing performance timings.
Reporter | ||
Comment 9•16 years ago
|
||
Attachment #365073 -
Attachment is obsolete: true
Attachment #365472 -
Flags: review?(lhansen)
Updated•16 years ago
|
Attachment #365472 -
Flags: review?(lhansen) → review+
Comment 10•16 years ago
|
||
Comment on attachment 365472 [details] [diff] [review]
Final patch [v2] - incorporating feedback from patch [v1] review
Fine with me. Seeding the RNG from the clock may not be smart given that getTime is allowed to return the time "since the system started", where "system" is not defined - could it be the VM? If so, the seeding could be too deterministic in practice. But, this is a separate bug (if it is a bug at all).
Reporter | ||
Comment 11•16 years ago
|
||
Changeset: 6183b3f1b6d8
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•