[Snort-devel] Event time info saved to database loses timezone information

Carlos Henrique Bauer bauer at ...549...
Fri Jul 20 12:59:06 EDT 2001


Hi,

Here is an example of row dates are saved in a database:

INSERT INTO event (sid,cid,signature,timestamp) VALUES ('1', '1', '4', 
'2001-07-20 11:20:22-03'

The '-03' in 2001-07-20 11:20:22-03 is the timezone where I'm located.

I'm currently adding Sybase support to the Snort database plugin. In my tests 
I noticed Sybase doesn't like the timezone part it the dates it receives from 
Snort.

I did some tests with a MySQL database and discovered it ignores '-03' when 
it converts a datetime string to a datetime value. In fact, if I try to store 
a datetime string like '2001-07-20 11:20:23xyz' in a datetime column it gives 
me no error. Conclusion, MySQL stops parsing a datetime string when it find a 
valid datetime, Sybase not.

How should an event date to be saved in a database: using GMT time or using 
localtime and storing the timezone info in another column?

Regards,

Carlos Bauer




More information about the Snort-devel mailing list