Re: SDL-News: time conversion


Subject: Re: SDL-News: time conversion
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Sat Dec 16 2000 - 10:46:42 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

Thomas Weigert at thomas.weigert#motorola.com wrote on 16/12/2000 02:51:

> We could, of course, also wonder why it has to be that time and duration
> have their special data types (in particular, as these are not very
> sophisticated types---no date fields, etc.). One could use reals for setting
> timers etc. just as well?
>
> Is there any good reason for not using reals to set SDL timers?

Yes, there is.

Because Time is a separate type, any value that is used to set a TIMER must
be a Time value. The general principle of strong type checking applies. The
operations on the Time type are limited, so that it is not possible to (for
example) add a Time to a Time or multiply a Time by a Time. Like any strong
type checking, this rejects some coding errors and therefore helps to assure
quality.

In any case, absolute Time values are not usually very useful, unless
expressed in terms of NOW + d, where d is a Duration value.

--
Rick Reed - rickreed#tseng.co.uk
Tel:+44 1455 55 96 55 Fax:+44 1455 55 96 58 Mob.:+44 7970 50 96 50

--End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT