Talk:Village/@comment-24142133-20131107184753/@comment-9531161-20131108233457

I would look at http://petitcomputer.wikia.com/wiki/TMREAD_(Command) and http://petitcomputer.wikia.com/wiki/DTREAD_(Command). What you're basically doing with these commands is getting numbers which represent the current time or date. For instance:

TMREAD(TIME$) HOURS, MINUTES, SECONDS

Now the current hour, minute, and second are stored as numbers in the variables stated above. You can use these numbers to do things like "do this every hour" (when MINUTES == 0) or "do this every minute" (when SECONDS == 0). For the date, you can do:

DTREAD(DATE$) YEAR,MONTH,DAY

Just as before, the current year, month, and day are stored as numbers in the variables given. If you wanted to count the days passed since another date, you could use an algorithm to compute the difference based on the month, day, and year. I would look around online for an algorithm to compute the offset from a far-back date (like January 1st, 1970). You could use this algorithm on a "previous date" and the current date, then subtract the offsets you computed to get the difference in days. There are lots and lots of examples of this algorithm online; most of them are going to compute the number of days since January 1st, 1970 for a given date.