I'm trying to make a license verification that should expire in a week with small basic. I could make a script that would write down the day the license was activated and that would expire the license as soon as the current day is 7 larger than the written amount. The problem is that if you'd activate the license on 28/any month, the license wouldn't expire since the current day would never be 35/any month. Is there a way to make small basic check if a date has been passed without making a script with about 100 If-Then's?
Asked
Active
Viewed 170 times
2 Answers
0
In gross terms, you need a date based upon an epoch, not the day of the month.
IOW, count the number of days since an event, store that value, when the current date is 7 days after the original date, expire.
http://litdev.co.uk/ offers a smallbasic library that provides this functionality if you don't want to roll your own.

KevinDTimm
- 14,226
- 3
- 42
- 60
-
Is the program able to count the days if it's not running, because i'm planning to apply this on a small game i've made. I'm just learning things. – Jaïr Paalman Jun 16 '15 at 18:31
-
While it's not running, of course not. But it can do the computation any time it starts and then you can expire the program if it passes X days. read https://en.wikipedia.org/wiki/Epoch_%28reference_date%29 for more information on epoch dates. – KevinDTimm Jun 16 '15 at 18:37
0
Save the time into a file using the
File.Writeline("File Path", 1, Clock.Date())
then compare it to the time when the program starts up again.
Days_since_last_on = Clock.Date() - File.Readline("File Path", 1)

Bob Cratchit
- 19
- 4