Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > TimeSpan Convenience

Reply
Thread Tools

TimeSpan Convenience

 
 
Chris Smith
Guest
Posts: n/a
 
      12-17-2006
John Ersatznom <(E-Mail Removed)> wrote:
> For a generic duration object, you'd use the approximation of 1 day ~=
> 86400 seconds when expressing it in the UI, and internally it would just
> be a number of msec.


I would? I suppose I would do that with days or years only if that
level of precision really didn't matter, and I'd document it since I'm
really giving the wrong answer.

--
Chris Smith
 
Reply With Quote
 
 
 
 
Josef Pfleger
Guest
Posts: n/a
 
      12-23-2006
Chris Smith wrote:
> It's the days that cause the problem. You can easily get seconds,
> minutes, and hours from calculations on the number of milliseconds,
> but days depends on the starting time and DST conventions.


So it seems that the definition of the word 'day' has become the point
of interest here. According to the first definition in the Oxford
English Dictionary, a day is "a period of twenty-four hours as a unit of
time, reckoned from midnight to midnight and corresponding to a rotation
of the earth on its axis".
http://www.askoxford.com/concise_oed/day?view=uk

Obviously, Microsoft implemented a day as a fixed unit of time according
to this definition in it's System.TimeSpan structure. So did I at the
link posted and this is why I'm still convinced that my code is correct

I realize that there are other definitions out there (some may include
DST and timezone issues) but I aimed for a simpler interface and was
basically imitating Microsoft's implementation.

- Josef
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-23-2006
Josef Pfleger wrote:
> So it seems that the definition of the word 'day' has become the point
> of interest here. According to the first definition in the Oxford
> English Dictionary, a day is "a period of twenty-four hours as a unit of
> time, reckoned from midnight to midnight and corresponding to a rotation
> of the earth on its axis".
> http://www.askoxford.com/concise_oed/day?view=uk


This definition is self-inconsistent for days when there is a timezone change,
because the period from midnight to midnight will not be twenty-four hours.
Which part of this particular definition should we invalidate?

http://www.unc.edu/~rowlett/units/dictD.html
gives three separate definitions.

- Lew
 
Reply With Quote
 
Josef Pfleger
Guest
Posts: n/a
 
      12-23-2006
Lew wrote:
> This definition is self-inconsistent for days when there is a timezone
> change, because the period from midnight to midnight will not be
> twenty-four hours.

I agree that timezone or DST borders are not explicitly mentioned. But
it does refer to the rotation of the earth on its axis which gives a
hint that they are defining the 'mean solar day', which is 24 hours long.

> http://www.unc.edu/~rowlett/units/dictD.html

Ok, so what I implemented is the 'mean solar day'. Thank you for the
clarification. I will document it accordingly.
 
Reply With Quote
 
Mark Thornton
Guest
Posts: n/a
 
      12-23-2006
Josef Pfleger wrote:
> Chris Smith wrote:
> > It's the days that cause the problem. You can easily get seconds,
> > minutes, and hours from calculations on the number of milliseconds,
> > but days depends on the starting time and DST conventions.

>
> So it seems that the definition of the word 'day' has become the point
> of interest here. According to the first definition in the Oxford
> English Dictionary, a day is "a period of twenty-four hours as a unit of
> time, reckoned from midnight to midnight and corresponding to a rotation
> of the earth on its axis".
> http://www.askoxford.com/concise_oed/day?view=uk


And what of the midnight to midnight bit? How many days in a 24 hour
period starting at midday?

Mark Thornton
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I convert a DateTime table column to a TimeSpan or DayOfWeek ? Harry Haller ASP .Net 0 07-21-2005 11:35 AM
TimeSpan problem Rosanne ASP .Net 1 07-20-2005 09:46 AM
Using TimeSpan or Elapsed e.t.c. Methods =?Utf-8?B?S2VubmV0aCBQ?= ASP .Net 5 11-07-2004 09:49 PM
Question: TimeSpan VB Programmer ASP .Net 3 07-15-2004 08:27 AM
Timespan calculations Clive C++ 3 09-08-2003 06:50 AM



Advertisments