Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:45 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Bug in EPOCH()?

Author Message
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 393
Posted: 05:59pm 08 May 2023
Copy link to clipboard 
Print this post

I wonder if this is a bug in the EPOCH() function in MMBASIC VER 5.07.00, or just my usual stupidity?

This little program gives me a syntax error when it hits the epoch() function:


option default integer
fname$ = "Solver.bas"
mdt$ = MM.INFO$(MODIFIED fname$)
print mdt$
secs = epoch(mdt$)
print secs
end


The date/time string printed out on line 4 looks fine: "08-05-2023 13:58:04"
But I get "Error on line 5: Invalid date"

Any clues?

-Bill
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4044
Posted: 06:09pm 08 May 2023
Copy link to clipboard 
Print this post

Which 'mite ? I don't think 5.07.00 is the latest release version on any of them.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 393
Posted: 06:11pm 08 May 2023
Copy link to clipboard 
Print this post

  thwill said  Which 'mite ? I don't think 5.07.00 is the latest release version on any of them.

Best wishes,

Tom


Color Maximite 2 Gen 2. I haven't seen any more recent releases for the CMM2 except for betas, but I may have missed one.

-Bill
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4044
Posted: 06:16pm 08 May 2023
Copy link to clipboard 
Print this post

The latest release version on Geoff's website is 5.07.01.

I'm pretty sure that I've found and Peter has fixed at least one bug in the CMM2 EPOCH() implementation, but that may have been for one of the 5.07.02 betas.

Best wishes,

Tom
Edited 2023-05-09 04:17 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 393
Posted: 06:20pm 08 May 2023
Copy link to clipboard 
Print this post

Thanks, Tom! For now, I will just write my own version of epoch(), not too hard.

-Bill
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9131
Posted: 06:35pm 08 May 2023
Copy link to clipboard 
Print this post

The time string from modified is the wrong way round - should be "YYYY-MM-DD HH:MM:SS". This is certainly corrected in the current beta but I'm not sure when the correction was made. in fact the latest betas allows both time formats for epoch
Edited 2023-05-09 04:39 by matherp
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2077
Posted: 07:29pm 08 May 2023
Copy link to clipboard 
Print this post

  William Leue said  ...I will just write my own version of epoch()...


http://www.fruitoftheshed.com/MMBasic.UnixTime-or-Epoch-Time.ashx

may help. written for the Micromite, works well but I think you'd be better tweaking it to fit the PicoMite because there are functions in the later basics that are not present for the micromite e.g. Field() This function works tightly with my Split() function  (which is comparable with Field) referenced in the wiki.

This UnxTime() function gets battered in loads of my code
Edited 2023-05-09 05:31 by CaptainBoing
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 393
Posted: 08:06pm 08 May 2023
Copy link to clipboard 
Print this post

  matherp said  The time string from modified is the wrong way round - should be "YYYY-MM-DD HH:MM:SS". This is certainly corrected in the current beta but I'm not sure when the correction was made. in fact the latest betas allows both time formats for epoch


Thanks, Peter! I had just finished my code where I turn around the date fields and yes, it works fine.

-Bill
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024