Reputation: 329
This question is slightly related to this one.
Using the NetLogo time extension on NetLogo 5.1.0 and Windows 8.1, I would like my simulation to
According to the time documentation, this should be possible:
"So if you use the time:plus primitive to add 1 month to the date "2012-02-02", you will get "2012- 03-02"; and if you add another month you get "2012-04-02" even though February and March have different numbers of days."
However, in my minimal working example below, the output of the print
command in the console is 2011 January 2
, 2011 February 2
, 2011 March 5
and 2011 April 5
.
So, how can I schedule a task on the some day each month?
Bonus question: How can I schedule the task in the first of each month (instead of the second)?
Here's the working example:
extensions [time]
globals[
start-time
current-time
]
to setup
clear-all
reset-ticks
set start-time time:create "2011-01-01"
set current-time time:anchor-to-ticks start-time 1.0 "days"
time:anchor-schedule start-time 1.0 "days"
;time:schedule-repeating-event-with-period "observer" task do-daily 1 1.0 "days"
time:schedule-repeating-event-with-period "observer" task do-monthly 1 1 "months"
go-until
end
to do-daily
; here are the daily tasks
end
to do-monthly
; here are the monthly tasks
print time:show current-time "yyyy MMMM d"
end
to go-until
time:go-until 100
end
Upvotes: 1
Views: 477
Reputation: 56
This was a bug that has now been fixed. See:
https://github.com/colinsheppard/time/issues/34
Upvotes: 3