Time Problem

In a group I added a Action Item “timer” which condition set as hour=23, min=59 and sec>=0 and sec<=30
and Group’s Update Rate=30 second. The timer is the trigger item for the group i.e it has to log data every day at 23:59:(0-30) but I am facing some variation of time on data logging at SQL server.
Sometime it log data at 23:58,00:06…
please refer to attached file for variation.

Regards,
Subodh
log data.xls (25.5 KB)

What is the exact expression on the timer condition?

Also, is the database on a different server? How are you getting the time for the trigger? It could be a difference between the clocks of the FactorySQL machine, and the database server. The query that FactorySQL sends to the server will have “t_stamp=CURRENT_TIMESTAMP”, so the time recorded will be the database time. If you’re getting the trigger time with an expression and “now()” (or one of the other similar functions), you’re using the time on the local machine.

If this sounds like your setup, I would recommend logging the local machine time as the timestamp. You can do this easily:

  1. On the group, turn off “store timestamp”
  2. Create an Action Item, set it to “DateTime” datatype, writeback to “t_stamp”, and set its expression to “now()”.

Regards,

the exact condition for Action item “Timer” is as follow:-

If((ExtractHour(Now())=12 && ExtractMinute(Now())=59 && ExtractSecond(Now())>=0 && ExtractSecond(Now()) <=30),1,0)

and “t_stamp” data is directly dump to the server from factory SQL.

Regards,
Subodh

Hello,

You forgot to mention if the database is on a different machine. I suspect it’s as I described earlier- I recommend turning off “store timestamp” and making your own timestamp item based on “now()” and seeing if that changes things.

Regards,

After creating my own action item for date time (t_stamp) on group the problem of time mismatch has solved …
Thanks for ur help…

Regards,
Subodh Pradhan