🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3426

Re: help on longcard

#3426
From: WILL BURROW
Date: Wed, 27 Mar 1996 23:13
32 lines
1898 bytes
  In a message on 21 March:

PPE> >elapsed since midnight.
PPE> >This would entail storing a value <= 86400.
PPE> >The GetTime procedure returns CARDINAL values for - minutes since
PPE> >midnight and milliseconds past the minute.
PPE> >I intended to use the following:
PPE> >MyTime := GetTime((SysTime.minutes)*60)+(SysTime.millisec)/1000));
PPE> >However the result produced can be a value that requires a LONGCARD for
PPE> >storage.
PPE> >I have to date not been able to get the result into a VAR declared AS
PPE> >LONGCARD. I have tried LONG(..) to no avail.
PPE> >Have I missed something basic? A CARDINAL is stored in 2 bytes and a
PPE> >LONGCARD in 4 bytes so why is there not a procedure to convert?
PPE> >My tutor for this subject is not available for several days, none of my

For starters, that '/' is going to cost you.  Integers use DIV.  Next, FST
needs a combination of operaters to do the conversion (to LONGINT), then a
coercion (to LONGCARD).  (Conversions change the TYPE and its SIZE,
coercions just change the TYPE.)  The line of code below will do the
trick:

    midnightSecs := LONGCARD( LONG( t.minute )) * 60L 
                    + LONGCARD( LONG( t.millisec DIV 1000 ));

BTW, could anyone who receives this send an e-mail to confirm they received
it??   I am not sure if it is getting out or not.

Will.
  
...
 * ATP/Linux 1.42 * Repartee: An insult with a suit and tie on.
Technical Details
Message-ID: <8BD83CD.013500026C.uuout@tad.com>
Path: arc1-ca.pugleaf.net!scratchy.mi.net!tad!will.burrow
References: <DoMsKr.C6o@avalon.chinalake.navy.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!scratchy.mi.net!tad!will.burrow
From: will.burrow@tad.com (WILL BURROW)
Newsgroups: comp.lang.modula2
Subject: Re: help on longcard
Message-ID: <8BD83CD.013500026C.uuout@tad.com>
Date: Wed, 27 Mar 96 16:13:00 -0700
Distribution: world
Organization: TRANS ATLANTIC DIMENSIONS
Reply-To: will.burrow@tad.com (WILL BURROW)
References: <DoMsKr.C6o@avalon.chinalake.navy.mil>
X-Newsreader: PCBoard Version 15.22
X-Mailer: PCBoard/UUOUT Version 1.20