Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS
From: ThE mOuNtIaNdEw FiEnD (pdpa_at_mountaindewfiend.com)
Date: 11/09/03
- Next message: Arthur J. O'Dwyer: "Re: Natural language programming?"
- Previous message: Roger Johansson: "Re: Natural language programming?"
- In reply to: osmium: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Next in thread: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Reply: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 09 Nov 2003 05:25:26 GMT
Or at the very least, precompute how many seconds in a leap year, and
how many in a normal year, then you can figure out howmany leap years
have elapsed since 1970, then howmany regular years.. and so forth
On Thu, 6 Nov 2003 09:52:14 -0800, "osmium" <r124c4u102@comcast.net>
wrote:
>Gustavo Rios writes:
>
>> i am faced with a problem to convert a given number of seconds since
>> 01/01/1970 UTC to a given format: YYYY-MM-DD : HH-MM-SS. The problem
>> is that some years have 366 days, others, 365. How do i account for
>> that?
>>
>> I have wrote a very basic rudimentar routine, but it uses a loop,
>> i.e., too slow. (if i was considering using SUSV#/ANSI C facilities i
>> would not be posting to here, of course - I need to write my own
>> routine). Does anybody here have the theory behind such a conversion?
>> I need a very fast conversion. If some one here have an answer, let me
>> known.
>
>Just thinking out loud ....
>
>There haven't been that many years since 1970. How about pre-computing an
>array of literals that contain the number of seconds at 00:00 1-1-2003, for
>example. Use that array in your solution.
>
- Next message: Arthur J. O'Dwyer: "Re: Natural language programming?"
- Previous message: Roger Johansson: "Re: Natural language programming?"
- In reply to: osmium: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Next in thread: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Reply: Olathe: "Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]