This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,11 +213,24 @@ end
213213 * CET timezone.
214214 *
215215 * @since 0.1.0
216+ * @updated 1.3.1
216217 *
217218 * @returns {number} - CET offset in seconds
218219--]]
219220function cetoffset ()
220- return utcoffset () - tern (math.abs (os.date (' *t' ).yday - 187 ) < 46 , 7200 , 3600 )
221+ -- List taken from http://www.timeanddate.com/time/zone/germany/frankfurt
222+ local daylightDates = {
223+ [2013 ] = {90 , 300 },
224+ [2014 ] = {89 , 299 },
225+ [2015 ] = {88 , 298 },
226+ [2016 ] = {87 , 304 },
227+ [2017 ] = {85 , 302 }
228+ }
229+
230+ local now = os.date (' !*t' )
231+ local daylightDate = daylightDates [now .year ]
232+
233+ return utcoffset () + tern (now .yday >= daylightDate [1 ] and now .yday <= daylightDate [2 ], 7200 , 3600 )
221234end
222235
223236--[[
@@ -235,12 +248,12 @@ end
235248 * Returns the current time of day, in seconds, on CET timezone.
236249 *
237250 * @since 0.1.0
238- * @modified 1.0.2
251+ * @updated 1.3.1
239252 *
240253 * @returns {number} - CET time of day in seconds
241254--]]
242255function cettime ()
243- return tosec ( os.date ( ' !%X ' )) + tern ( math.abs ( os.date ( ' *t ' ). yday - 187 ) < 46 , 7200 , 3600 )
256+ return utctime () - utcoffset () + cetoffset ( )
244257end
245258
246259--[[
You can’t perform that action at this time.
0 commit comments