Closed Hong1008 closed 3 years ago
I don't mind having the seconds there, however, I haven't seen this in any cron system (yet). Do you have a reference/specification that uses it? (I also thought that the 6th parameter could be a year - although that makes little practical use...)
I don't mind having the seconds there, however, I haven't seen this in any cron system (yet). Do you have a reference/specification that uses it? (I also thought that the 6th parameter could be a year - although that makes little practical use...)
see: https://en.wikipedia.org/wiki/Cron#Overview There's a phrase like this. "In some uses of the CRON format there is also a seconds field at the beginning of the pattern. In that case, the CRON expression is a string comprising 6 or 7 fields." I have to synchronize data every 30 seconds without use Timer in dart, because I want to synchronize on time
Well, I've solved my problem now like this.
Timer.periodic(Duration(seconds: 1), (timer) {
var seconds = DateTime.now().second;
if(seconds == 0 || seconds == 30){
//do job
}
});
You don't have to take this PR if you don't want to.
I'll add some tests tomorrow and will publish it after that.
FYI: I've updated some parts, fixed a small issue, and published.
When the CRON expression is a string comprising 6 fields, there is a seconds field at the beginning of the pattern.
Cron().schedule(Schedule.parse('* * * * * *'), () async { print('every seconds'); });