Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / GetCurrentTime() strange behaviour

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 9th Feb 2016 21:04
If I use Print(GetCurrentTime()) it seems to work fine. However, if I try and assign it to a variable it doesn't work. Can anybody else replicate?
SpecTre
Developer
22
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 9th Feb 2016 21:10 Edited at: 9th Feb 2016 21:14
Use:

t$ = GetCurrentTime()
Print(t$)

It shows as a string.


[EDIT]
@CJB

Posted at same TIME haha

I think maybe was trying to put the time into an integer variable and thats why didn't work?
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
CJB
Valued Member
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 9th Feb 2016 21:10
Seems fine here.

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 10th Feb 2016 21:55
Thanks guys. I'm pretty sure I used a string variable and still had issues. But it seems to be working now. Maybe I was just being a muppet.
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 10th Feb 2016 23:00
Actually, something still isn't right. In the code below, if you run it then it appears to work (it prints the hours and minutes only). However, if you set a breakpoint before the print command and then debug the t$ variable appears to be empty. It's as if the Print() command is necessary to evaluate the GetCurrentDate() function. This is no good if I'm just trying to get the string to use in operations that don't output it.

Or is my AppGameKit IDE playing tricks on me?

CJB
Valued Member
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 11th Feb 2016 00:30
This code just uses the string in operations that don't output the time Looks like it is working as it should. I haven't played with the debugger that much so not sure how it is supposed to behave.

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Feb 2016 08:37 Edited at: 11th Feb 2016 08:38
Wow!
The debugger is bugged

Try this code and keep single-stepping it. You will see:

1. Integers are OK.
2. Screen Output is OK
3. Log() output is OK
4. Strings with a hardcoded value before a breakpoint hits have a value
5. After first breakpoint, they never get updated again
6. getCurrentTime() is never output to the debug window, even when enclosed by other hardcoded values

So...your code will be ok, but the debugger needs fixing!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Feb 2016 18:14 Edited at: 12th Feb 2016 18:14
Thanks, fixed for the next version. The problem was the colon character, it was being used as a delimiter in the debug string handler so strings containing colons messed everything up.

Login to post a reply

Server time is: 2025-06-06 17:31:56
Your offset time is: 2025-06-06 17:31:56