[1035] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next next in chain last in chain last

Re: [COLD] behaviour of localtime()

daemon@ATHENA.MIT.EDU (Tue Jul 23 15:06:37 1996 )

From: Jay Carlson <nop@nop.com>
To: Andrew Wilson <andrew@aaaaaaaa.demon.co.uk>
cc: Brandon Gillespie <brandon@tombstone.sunrem.com>, coldstuff@cold.org
In-reply-to: Your message of "Tue, 23 Jul 96 17:14:07 BST."
             <199607231614.RAA01653@aaaaaaaa.demon.co.uk> 
Date: Tue, 23 Jul 96 14:28:56 -0400

Andy writes:

>> Right now localtime works like:
>> 
>>     1. INTEGER time (same as returned by the function time()) 
>>     2. INTEGER seconds (0-59) 
>>     3. INTEGER minutes (0-59) 
>
>[snippety...]
>
>> Which is basically a raw dump of the C function localtime().  Because 
>> Cold scales arrays starting at one rather than zero, I think I will change 
>> it to add one to elements 2 - 9 (excluding the year and day of the month), 
>> instead giving you:
>> 
>>     1. INTEGER time (same as returned by the function time())
>>     2. INTEGER seconds (1-60)
>>     3. INTEGER minutes (1-60)
>
>[snip...]
>
>> The reason for this is any likely use of localtime() in ColdC will 
>> inevitably require you to add one to the value, so why not do it in 
>> native code rather than interpreted code?

> What is this, April 1st?

3/0/96.

>  Under this proposal I'll be forced to
> subtract one from seconds and minutes to get the right answer?

I think that part's ill-considered.  But as far as months and days go,
it's right on.

> I think, on general principal, that you shouldn't dick with
> something so important as localtime(), you'll be up to your ass in
> FAQ 'er why is cold's time code not standard C,

ColdC Is Not C.  Java Is Not C.  There Can Be Progress.

For what it's worth, the Java crowd is currently bemoaning their own
java.util.Date class; it has 0-based months.  That's a pretty big lose.

Jay Carlson
nop@nop.com    nop@ccs.neu.edu    nop@kagoona.mitre.org

Flat text is just *never* what you want.   ---stephen p spackman