im使用以下代码每隔一分钟打印一次日期时间。但是cron作业每分钟打印5次日期时间。请在错误之处提供帮助。
new CronJob({
cronTime: '*/1 * * * *',
onTick: async function() {
const d = new Date();
console.log('Current date time : ', d)
},
start: true
});
输出:
Current date time : 2019-12-15T08:28:00.001Z
Current date time : 2019-12-15T08:28:00.001Z
Current date time : 2019-12-15T08:28:00.002Z
Current date time : 2019-12-15T08:28:00.002Z
Current date time : 2019-12-15T08:28:00.001Z
Current date time : 2019-12-15T08:29:00.001Z
Current date time : 2019-12-15T08:29:00.003Z
Current date time : 2019-12-15T08:29:00.006Z
Current date time : 2019-12-15T08:29:00.005Z
Current date time : 2019-12-15T08:29:00.002Z