mrahhal / MR.AspNetCore.Jobs

A background processing library for Asp.Net Core.
MIT License
59 stars 9 forks source link

Ability to select timezone or using server time #16

Open ralfbalzer opened 6 years ago

ralfbalzer commented 6 years ago

It would be create, if the schedule could be changed to use either the local server time. As my system in is in Europe, I need to configured the schedule with an offset. Thanks for considering for a future version :-)

mrahhal commented 4 years ago

Sorry I haven't seen this until now for some reason (a full year later!).

Are you talking about scheduling a delayed job and giving the due date? If so, the method already takes a DateTimeOffset, right? So maybe I'm misunderstanding.

ralfbalzer commented 4 years ago

I had this issue as the scheduler is using UTC. My system however is in CET (which is -1 hour from UTC and 2 hours to EST during the summer). I adjusted the scheulded hour (my jobs need to run at a certain time during the day). For the summertime, I added an adjust like this: int summerTimeAdjust = TimeZoneInfo.Local.IsDaylightSavingTime(DateTime.Now) ? 1 : 0; So my schedule looks like this: Cron.Weekly(DayOfWeek.Tuesday, 6 + summerTimeAdjust)

mrahhal commented 4 years ago

Oh we're talking about cron jobs. Yeah I see, I realize now that I should have allowed for a timezone. This is a valid issue.