Efried said:Hello,
when using WEBSET one might have different timestamps at the server (caused by timezone, accuracy...) when storing data via php.
Is there a way to sync the time?
May be sending WC timestamps to the server, filling up the 31bit variables...
thanks
I do have two times on the server because the folks from the provider (or GCHQ ;-) ) have set the wrong timezone, and no way to alter that...rossw said:Your server should be running ntp and should never be more than a few tens of milliseconds in error.
The webcontrol will be some time "roughly close"
Always timestamp using the servers (accurate) time and discard the wc time.
What I do (when passing events that could have been some time in the past) is to send "how many seconds ago" it was and do the math on the server, thus eliminating the need for *accurate* time on the WC boards.
I understand that the webcontrol parses to the first non-numeric character.Efried said:wow great. in the handbook the command is followed by \m, what kind of delimiter is needed.
? thanks
Hi, you are the best chap helping others out. My code had several issues. It might be helpful if CAI discloses more about the issue....rossw said:I understand that the webcontrol parses to the first non-numeric character.
My testing at the time indicates it stops at the first non-number character *PROVIDED* there are enough characters in the buffer for it to have enough time to decode them all before the buffer itself is released. If you like, I'll try to find my notes at the time that indicated just how many were required.
Efried said:Hi, you are the best chap helping others out. My code had several issues. It might be helpful if CAI discloses more about the issue....
This is my return now, which does not work: content-type: text/plain SET_WC=1 xxxxxxxxxxxxx Ende der Rückgabe
08:58:00-28/03/13| <CAI_Support> Basically to make WEBSET read back reliably, it is better to have some data bytes after valid data, so that server will send FIN later.
08:58:06-28/03/13| <RossW> I can change it to always return you something constant if you wish, but the problem is that the WC seems to be truncating the answer.
08:58:27-28/03/13| <RossW> yes, I have had to add about 12 bytes after the reply....
08:59:04-28/03/13| <CAI_Support> That is fine, you need to test out a reliable range for server CGI to send, and WEBSET to receive.
09:00:04-28/03/13| <RossW> Wayne: can I suggest that that be made clear in the documentation for the CGI? It seems really odd that we have to put
"junk" after the reply just to get it to process
09:00:49-28/03/13| <RossW> When I initially wrote my CGI, the webset command was getting NOTHING back at all... and it took a lot of digging to figure out what was going on.
rossw said:OK, Couldn't find anything in my email, but did find it in an IRC log. Small excerpt quoted here:
Efried said:I also fear to have been run into another problem:
daylight saving might not by switched on autmatically in the WC?
thanks
CAI_Support said:Ross is correct, if you want to enable day light saving, you will have to do it in PLC code, we have examples posted in this forum before. The reason is that there are just so many different timezones and different dates for day light saving to start and to end.
Efried said:Thanks, unfortunately this is no option since I do need exactly the same time on the server and PLC, so there is need for a correct external time reference both the UNIX server and the WC are using. For now I think I have to keep UTC and skip DST.
rossw said:1. The WC uses ntp
2. You will never get *EXACTLY* the same time. (I have a heap of devices and even using precision GPS time references, it's hard to get better than within a few tens of nanoseconds)
3. How close to the same time do you really need?
4. Why do you (think you) need such precision of time?
5. It is easy enough to set a webset to query your server for local offset (eg, start of end of daylight savings), and add an offset (which may be 0 or may be an hour), as and when your server determines daylight savings starts or ends.
6. Skipping DST is the smartest thing anyway. When you have stuff in countries all over the world in a plethora of timezones, the only thing that makes sense is UTC.