reugn / go-quartz

Minimalist and zero-dependency scheduling library for Go
https://pkg.go.dev/github.com/reugn/go-quartz/quartz
MIT License
1.8k stars 85 forks source link

api: use time.Time instead of int64 #32

Open dolmen opened 2 years ago

dolmen commented 2 years ago

Suggestion for API change: use time.Time instead of int64 in the exposed API. That would be more idiomatic.

dolmen commented 2 years ago

@nightwolfz You voted against this proposal. Could you explain?

yusufozturk commented 2 years ago

I think in general using Epoch value is much safer. Quartz returns an interval value which is a total number of nanoseconds/milliseconds/seconds etc. So taking Epoch value as an input and adding quartz interval on top of it is much easier and safer option for the library.

With Epoch value, you can easily escape from timezone problems and It's very easy to convert time into the Unix time.

yusufozturk commented 2 years ago

A similar issue when timezone is in place: https://github.com/reugn/go-quartz/issues/33