mvniekerk / tokio-cron-scheduler

Schedule tasks on Tokio using cron-like annotation
Apache License 2.0
529 stars 59 forks source link

How to support run in LOCAL time #41

Closed daiguadaidai closed 9 months ago

daiguadaidai commented 1 year ago

can you give solve LOCAL TIME problem example code?

and you can use LOCAL in job/mod.rs file, line: 112

about code:

Utc modify Local

        Ok(Self(Arc::new(RwLock::new(Box::new(CronJob {
            data: JobStoredData {
                id: Some(job_id.into()),
                last_updated: None,
                last_tick: None,
                next_tick: schedule
                    .upcoming(Utc)             //////////////////////// here
                    .next()
                    .map(|t| t.timestamp() as u64)
                    .unwrap_or(0),
                job_type: JobType::Cron.into(),
                count: 0,
                extra: vec![],
                ran: false,
                stopped: false,
                #[cfg(feature = "has_bytes")]
                job: Some(job_data_prost::job_stored_data::Job::CronJob(
                    job_data_prost::CronJob {
                        schedule: schedule.to_string(),
                    },
                )),
                #[cfg(not(feature = "has_bytes"))]
                job: Some(job_data::job_stored_data::Job::CronJob(job_data::CronJob {
                    schedule: schedule.to_string(),
                })),
            },
            run: Box::new(run),
            run_async: Box::new(nop_async),
            async_job: false,
        })))))
mvniekerk commented 9 months ago

Please check version 0.10.0 if it works better for you?