Previous Thread
Next Thread
Print Thread
Sub second values #35172 26 Apr 22 07:19 AM
Joined: Oct 2015
Posts: 237
S
Stuart Offline OP
Member
OP Offline
Member
S
Joined: Oct 2015
Posts: 237
I presume I must be doing something wrong, but can't see what. We have three dot variables listed: .TIME, .MILLITIME and .MICROTIME.

I seem to be able to obtain a string value from .TIME but cannot get either a numeric or string value from either .MILLITIME or .MICROTIME.

I have tried the following code:
Code
map1 tmp'int,i,4
map1 tmp'num,f,6
map1 tmp'str,s,0

tmp'int = .MILLITIME
tmp'num = .MILLITIME
tmp'str = .MILLITIME

Is there a particular variable type that should be used to receive the value, or is there a particular way of using them?

Re: Sub second values [Re: Stuart] #35173 26 Apr 22 08:17 AM
Joined: Jun 2001
Posts: 11,945
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,945
Hmmm..., not sure what the issue is here. In theory, dot variables should act like any other kind of variables, meaning you can use them as-is, in expressions, and you can assign them to any other kind of variable type (subject to type conversion rules). In the case of .TIME (HHMMSS) you'll lose the leading zero when converting to a numeric variable, but that wouldn't be an issue for .MILLITIME or .MICROTIME.

Here's an expanded version of your test program ...
Code
map1 tmp'int,i,4
map1 tmp'num,f,6
map1 tmp'str,s,0

significance 11

tmp'int = TIME
tmp'num = TIME
tmp'str = TIME
print "TIME: "; tmp'int,tmp'num,tmp'str,TIME

tmp'int = .TIME
tmp'num = .TIME
tmp'str = .TIME
print ".TIME: "; tmp'int,tmp'num,tmp'str,.TIME

tmp'int = .MILLITIME
tmp'num = .MILLITIME
tmp'str = .MILLITIME
print ".MILLITIME: "; tmp'int,tmp'num,tmp'str,.MILLITIME

tmp'int = .MICROTIME
tmp'num = .MICROTIME
tmp'str = .MICROTIME
print ".MICROTIME: "; tmp'int,tmp'num,tmp'str,.MICROTIME

END

... which displays, at least here under 6.5.1715.8 ...
Code
TIME:  29391   29391        29391          29391
.TIME:  80951                80951        080951        080951
.MILLITIME:  29391542        29391542     29391542       29391542
.MICROTIME: -673228180       29391542892  29391542892    29391542892

To zero in on this, let's see what you get with the above program. Also which version are you running?

Re: Sub second values [Re: Stuart] #35174 26 Apr 22 08:30 AM
Joined: Oct 2015
Posts: 237
S
Stuart Offline OP
Member
OP Offline
Member
S
Joined: Oct 2015
Posts: 237
There are not any comments regarding all the individual dot variables. Should they be available under 6.4?

I expect that will be the issue, as only the TIME and .TIME variables appear to be recognised (they have a different colour). The .MILLITIME and .MICROTIME appear to be recognised as user variables (black).

Last edited by Stuart; 26 Apr 22 08:34 AM.
Re: Sub second values [Re: Stuart] #35175 26 Apr 22 08:38 AM
Joined: Oct 2015
Posts: 237
S
Stuart Offline OP
Member
OP Offline
Member
S
Joined: Oct 2015
Posts: 237
Cancel all that. I have just looked again and (of course) these variables came in with 6.5.

Not to worry. I'll just have to go old school with a host command.

Re: Sub second values [Re: Stuart] #35176 26 Apr 22 09:05 AM
Joined: Oct 2015
Posts: 237
S
Stuart Offline OP
Member
OP Offline
Member
S
Joined: Oct 2015
Posts: 237
Probably better than that, I have used xcall TIMES.

Re: Sub second values [Re: Stuart] #35177 26 Apr 22 09:23 AM
Joined: Jun 2001
Posts: 11,945
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,945
Fortunately there are many ways to skin this cat!

I had originally suspected that you must be running a version prior to the introduction of .MILLITIME and .MICROTIME and that you must be compiling without /M. But at least under the current compiler, it doesn't allow unmapped dot variables, regardless of the /M switch. But I guess that was another 6.5 compiler enhancement that I had forgotten about. While on that subject though, another refinement in 6.5 is that the compiler will embed the minimum runtime version in the RUN header (based on the language features used in the program), eliminating some variations of this kind of confusion when compiling and running in different environments. (Another argument for updating!)


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3