How to convert UTC ordinals to UTC 5-byte time

How to convert UTC ordinals to UTC 5-byte time

Post by Dave Higto » Fri, 01 Jan 2010 06:13:22


How can one convert UTC ordinals to a 5-byte UTC time?

I can find a territory-dependent version, which implies a conversion
error during either DST or non-DST; but I can't find a way either to
specify UTC input to Territory_ConvertOrdinalsToTime, or to do a
conversion that is inherently UTC-to-UTC.

If anyone knows the trick, please tell me what it is.

Dave
 
 
 

How to convert UTC ordinals to UTC 5-byte time

Post by jgh » Sat, 02 Jan 2010 05:38:23


In platform-independant BBC BASIC, use PROCDate_FromOrd() in the
Date library at http://www.yqcomputer.com/

Convert time and date to 5-byte centi-second count
==================================================
DEFPROCDate_FromOrd(mem%,d%,m%,y%,hr%,mn%,sc%,cs%)

On entry: mem%->five bytes of memory
day, month, year of the date
hours, minutes, seconds, centiseconds of the time
On exit: mem% to mem%+4 containes five-byte centisecond time since
00:00:00 on 1-Jan-1900.

Example:
DIM timebuf% 4
PROCDate_FromOrd(timebuf%, 7,1,1969, 00,30,00,00)

to get a certain personally interesting date-point.

Otherwise, for a RISC OS-only solution, you can use SWI
"Territory_ConvertOrdinalsToTime"

DIM utc% 4
DIM ord% 27
ord%!0=centisecond
ord%!4=seconds
ord%!8=minutes
ord%!12=hours
ord%!16=day
ord%!20=month
ord%!24=year
SYS "Territory_ConvertOrdinalsToTime", -1, utc%, ord%

but as you say, that converts local time, not to UTC, so does DST/NODST
conversion.

--
J.G.Harston - XXXX@XXXXX.COM - mdfs.net/User/JGH
Whitby Yards Gazetteer - http://www.yqcomputer.com/

 
 
 

How to convert UTC ordinals to UTC 5-byte time

Post by Dave Higto » Sun, 03 Jan 2010 00:57:22

In message < XXXX@XXXXX.COM >




OK, thanks for that.


Yes. A curious omission from RISC OS. Worse than just DST/NODST,
if my app is used in a territory other than GMT or GMT - 1, the
above will add an even bigger error.

It would be neat if there were a Territory (perhaps 0?) representing
UTC, so that SYS "Territory_ConvertOrdinalsToTime" could be called
with that Territory and therefore always return the correct time.

Dave
 
 
 

How to convert UTC ordinals to UTC 5-byte time

Post by Jean-Miche » Sun, 03 Jan 2010 20:39:24

In message < XXXX@XXXXX.COM >












How did you do it, you predict the Iyonix date BUG ?

Jean-Michel


--
Jean-Michel BRUCK
XXXX@XXXXX.COM
Europn Computer : RISC OS ( Iyonix pc 5.13 & RiscPc (Select))
 
 
 

How to convert UTC ordinals to UTC 5-byte time

Post by Jeremy Nic » Mon, 04 Jan 2010 09:51:40


Tardis, probably.

--
Jeremy C B Nicoll - my opinions are my own.

Email sent to my from-address will be deleted. Instead, please reply
to XXXX@XXXXX.COM replacing "nnn" by "284".