Ticket #1928 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Kernel::DateAndTime: Combine PulseTimeType and dateAndTime types.

Reported by: Janik Zikovsky Owned by: Janik Zikovsky
Priority: major Milestone: Iteration 26
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Whitty

Description

I have gotten issues with giving large values to time_duration types, etc., where int overflows occured.

Change History

comment:1 Changed 10 years ago by Janik Zikovsky

  • Status changed from new to accepted

comment:2 Changed 10 years ago by Janik Zikovsky

  • Summary changed from Kernel::DateAndTime: make sure limits to dates and times are handled correctly to Kernel::DateAndTime: Combine PulseTimeType and dateAndTime types.

I have found that boost dateAndTime does not correctly support more than +- 263 nanoseconds anyway because of overflows in time_duration. This means that there is no reason to use boost::posix_time directly anywhere in the program since some operations, like - give incorrect results.

Instead, perhaps it would be best to use a custom dateAndTime type that uses only 8 bytes of memory, such as the int64_t type.

Also, make sure limits to dates and times are handled correctly.

comment:3 Changed 10 years ago by Janik Zikovsky

(In [7458]) Refs #1928: Initial check-in of new time structure; mostly want to make sure the data size is 8 bytes on all platforms.

comment:4 Changed 10 years ago by Nick Draper

Janik,

Is this removing Boost posix time from mantid completely or just in this situation.

Regards, Nick Draper

comment:5 Changed 10 years ago by Janik Zikovsky

I would use boost posix time within the class to read strings etc. but store it as an int64. By overloading the various operators I will be able to work around the overflow bug. And it will make converting from pulseTimeType to dateAndTime unnecessary.

comment:6 Changed 10 years ago by Janik Zikovsky

(In [7535]) Refs #1928: Temporary fix to LoadSNSEventNexus until I finish ticket 1928.

comment:7 Changed 10 years ago by Janik Zikovsky

(In [7544]) Refs #1928: PulseTimeType and dateAndTime were combined into a single date and time class, DateAndTime (note the more pleasant capitalization). This class handles all required operators and conversions, and stores the time as the number of nanoseconds since Jan 1, 1990, as an 8-byte int. The class avoids overflows in dates.

comment:8 Changed 10 years ago by Janik Zikovsky

(In [7547]) Refs #1928: Additional tests for DateAndTime

comment:9 Changed 10 years ago by Janik Zikovsky

(In [7548]) Refs #1928: More tests for DateAndTime; this covers every function on the class.

comment:10 Changed 10 years ago by Janik Zikovsky

(In [7552]) Refs #1928: DLLExport was in the wrong place (for Windows).

comment:11 Changed 10 years ago by Janik Zikovsky

(In [7554]) Refs #1928: #defines instead of consts because the mac build is being silly with large ints.

comment:12 Changed 10 years ago by Janik Zikovsky

(In [7556]) Refs #1928: Trying something else to make mac build happy. Also, reanbling parallel loading of event files which I had turned off to debug.

comment:13 Changed 10 years ago by Janik Zikovsky

(In [7557]) Refs #1928: Maybe this makes Mac happy?

comment:14 Changed 10 years ago by Janik Zikovsky

(In [7559]) Refs #1928: Reduce the number of lines output if FilterByTimeTest fails. Try something to help the DateAndTime test pass on windows 32 bit.

comment:15 Changed 10 years ago by Janik Zikovsky

(In [7560]) Refs #1928: Modified the time_t test.

comment:16 Changed 10 years ago by Russell Taylor

(In [7561]) Mac fix - hopefully won't break elsewhere. Re #1928.

comment:17 Changed 10 years ago by Martyn Gigg

(In [7562]) Hopefully this wil fix the build and test problems. The Mac seems to need LL on long long contants. Note that on the Mac sizeof(long)=4 but 64-bit linux has sizeof(long)=8. Re #1928

comment:18 Changed 10 years ago by Martyn Gigg

(In [7565]) Yet another try. DateAndTime is a bit more strict about what it will accept now so some places need to be a little more explicit. Re #1928

comment:19 Changed 10 years ago by Janik Zikovsky

  • Status changed from accepted to verify
  • Resolution set to fixed

Passes on all platforms now thanks to Martyn!

comment:20 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 26 to Iteration 27

Bulk move of tickets to iteration 27, if your ticket is essential for Iteration 26 then move it back.

comment:21 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 27 to Iteration 26

Sorry I didn't mean to move these ones reverting back to It 26

comment:22 Changed 10 years ago by Michael Whitty

  • Status changed from verify to verifying
  • Tester set to Michael Whitty

comment:23 Changed 10 years ago by Michael Whitty

  • Status changed from verifying to closed

this is done

comment:24 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2775

Note: See TracTickets for help on using tickets.