time_offset

Install and configure FormaLMS and DoceboCE
Post Reply
drewlander
Newbie
Posts: 13
Joined: Wed Feb 24, 2016 4:38 am
Version: forma.lms 1.4.1

time_offset

Post by drewlander »

I have found if you have the time_offset configured then the 0000-00-00 00:00:00 date\time stamps in the database are completed with the offset value. One major consequence is that the access to course objects can be altered. For a working example:

set the time offset in the php file or create the value name for the region and assign it a value in minutes. (eg: time_offset = 240 )
in any course object, set another object as a "prerequisite".
notice that in the database, the "publish_to" field will have the 0000-00-00 date then the hours and minutes will total the time offset, thus making the material inaccessible.
i.e.) if the time offset val = 240 then the publish_to date will be "0000-00-00 00:04:00"

I uncovered this while investigating the possibility of adding time-zones for displaying dates based on the user profile as discussed in another thread. I'm not sure a bug is necessary unless the time_offset is actually used by anyone, but I felt it worth noting in this forum for any developer's edification on the subject.

thx
-d
User avatar
alberto
FormaLms Guru
Posts: 1135
Joined: Fri Mar 02, 2012 9:18 am
Contact:

Re: time_offset

Post by alberto »

Thanks drewlander, we will discuss this with the developers
User avatar
canelli
FormaLms Guru
Posts: 496
Joined: Thu Nov 08, 2012 12:21 pm
Version: forma.lms 2.0
Contact:

Re: time_offset

Post by canelli »

Hi drewlander

I think that is not a bugs, but more investigation needed .

In any case, Care should be taken when using the timezone.

if all users have the same time zone you do not have to change the user display, simle set the correct TZ in the general configuration (remember that mysql and php timezone must be in sync).

if users use different timezone then you have to be careful what you put into the DB. in the DB all times should be stored with the same timezone (a good timezone in this case could be UTC or a well know TZ ) or must be stored with the TZ; all operations on dates / times should consider the TZ.

so, for me, the best thing would be
In output
a) reading from the DB dates/times in UTC
b) do the calculations in UTC
c) transforming the date/time in user's TZ at display

In input
a) getting a date/time in user TZ
b) turn it into UTC
c) make all the necessary calculations in UTC
d) save in DB the time in UTC

Claudio
Cercate nel forum le riposte prima di chiedere. Check the forum before posting
---------------
Claudio Anelli
Joint Technologies - Sistemi avanzati per l'information technology

http://www.joint-tech.com
---------------
Post Reply