Jack,

MapBasic doesn't deal with time very completely. There is a
Timer() function that returns the number of seconds since
Midnight, Jan 1, 1970, and since MB 4.5 there is also a Time()
function that returns system time as a string (HH:MM:SS). There
is also a collection of various methods for returning the system
time in MapInfo at
http://www.directionsmag.com/tools/default.asp?a=file&id=144.
Finally, not to be overlooked, there are a host of Time and
Locale Windows API functions that you could look at.

For your purposes, you might find that implementing the MS
Windows representation of time as a floating point number
containing the whole and fractional part of days since Midnight
Dec 31, 1899 to be pretty convenient. Then if your bear goes over
the mountain to see what he could see at 6:45 AM on Jan 12, 2000,
you calculate the number of days from midnight 12/31/1899 to
midnight 1/11/2000 in MB as: 
StringToDate ("1/11/2000") - StringToDate ("12/31/1899") = 36535
The fractional part of the day occurs on 1/12/2000 of course, so
converting 6:45 AM in a 24-hour day to a fraction is done like
so:
(6 + 45 / 60) / 24 = 0.28125
So the numerical time for 6:45 AM Jan 12, 2000 would be
36535.28125. With this number you can measure time differences
easily, and it should be easy to write functions to convert
between a Date/Time or elapsed time representation and a number.
Also if your bears cross time zones, you should probably go the
extra bit and include an offset from GMT so that your times stay
universally coordinated.

- Bill Thoen


Jack Wierzchowski wrote:
> 
> Hi Folks,
> I am writing a program that identifies pairs of radiotelemetry locations
> (grizzly bears) that cross a given vector (highway, in this case),
> calculates the point of crossing, and, based on the distance between the
> points and the point of crossing and the date attached to each point,
> estimates the time of highway crossing.
> That last one is my bane. How does MapBasic (ver 4.5) deal with Time, as
> hours, minutes, seconds? Is there a function one could use? Am I stuck with
> developing a routine that divides days by 24 to get the number of hours, and
> so on? Any help will be most appreciated.
> Jack
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to