# Time Problem

**URL:** <https://forum.inductiveautomation.com/t/time-problem/2546>\
**Category:** Archived Topics\
**Created:** [January 25, 2011, 1:19pm UTC](https://forum.inductiveautomation.com/t/time-problem/2546 "2011-01-25T13:19:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![subodh](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@subodh](https://forum.inductiveautomation.com/u/subodh)\
**Post date:** [January 25, 2011, 1:19pm UTC](https://forum.inductiveautomation.com/t/time-problem/2546/1 "2011-01-25T13:19:56Z")

</div>

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](https://us1.discourse-cdn.com/inductiveautomation/original/1X/9c3988814165fd534f82e09f9d048bbe9f68d9b6.xls) (25.5 KB)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 25, 2011, 5:38pm UTC](https://forum.inductiveautomation.com/t/time-problem/2546/2 "2011-01-25T17:38:31Z")

</div>

What is the exact expression on the timer condition?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [January 25, 2011, 9:38pm UTC](https://forum.inductiveautomation.com/t/time-problem/2546/3 "2011-01-25T21:38:51Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![subodh](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@subodh](https://forum.inductiveautomation.com/u/subodh)\
**Post date:** [January 27, 2011, 5:29am UTC](https://forum.inductiveautomation.com/t/time-problem/2546/4 "2011-01-27T05:29:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [January 27, 2011, 2:44pm UTC](https://forum.inductiveautomation.com/t/time-problem/2546/5 "2011-01-27T14:44:39Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![subodh](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@subodh](https://forum.inductiveautomation.com/u/subodh)\
**Post date:** [February 2, 2011, 4:47am UTC](https://forum.inductiveautomation.com/t/time-problem/2546/6 "2011-02-02T04:47:33Z")

</div>

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
