zmfilter - when it is actually launched?

Support and queries relating to all previous versions of ZoneMinder
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi again.

After some digging around, I can see that the problem is either in the zmfilter DateTimeToSQL, or in the strtotime. Any passed date/time string always returns date several hours backwards.

Update: The problem seems to reside in the strtotime() function. Every submitted time is shifted back, for example:

12/5/2005-13:00 ------converted ----> 2005-12-05 09:30:00
12/5/2005 13:00 ------converted ----> 2005-12-04 20:30:00

Thus I had to input values into the filter, which don't have any relation to the actual time, and because of that, also don't show anything on submitting the filter.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Did you set the filter as Time > 06:00 or DateTime? It looks like DateTime to me as it's not extracting just the time.

It's possible that the perl strtotime doesn't exactly match the php one (because they are based on different parsers). I will take a look.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Yes, I'm using the DateTime criteria. I also tried to separate the condition to separate Date and Time, but it still didn't work.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This looks like a timezone type issue to me, though your examples show the same time being converted to two different ones. Where are you based?

Also, it might be worth trying the more portable format of 2005-12-05 rather than 5/12/2005 and definately never ever use the US format of mm/dd/yyyy as nothing ever understands that.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

These examples are different by the date/time format:
12/5/2005-13:00 (with a dash) and 12/5/2005 13:00 (without).

Although 12/5/2005-13:00 and 12/5/2005-15:00 gives a 2 hours difference indeed.

The server is located in Israel, thus it's timezone is Asia/Jerusalem.

The "2005-12-05" time string is converted to the following one: 2005-12-04 20:30:00. As you can see, it always goes 3.5 hours back.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Curiouser and curiouser...

I don't know if you are happy dabbling in perl or not but the zmfilter date parsing is based on the UnixDate function from the Date::Manip package. It may be worth knocking up a short test script to try a few things out.

Something like this might be a start

Code: Select all

#!/usr/bin/perl -w

use strict;

use Date::Manip;
my $time_string = "2005-12-05 12:00:00";

print( UnixDate( $time_string, "%s" )."\n" );
print( UnixDate( $time_string, "%g" )."\n" );
might be a start.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi Phil.

The output was as follows:

1133764200
Mon, 05 Dec 2005 12:00:00 +0530


The +0530 output is interesting, as the Israel timezone is GMT +2.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes. This would seem to suggest a problem with timezones or locales on your system though. Or possibly a major bug in perl :?

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Perhaps you know of any information on the net, regarding the timezones/locales configuration? I searched on my own, but all the recommendations (like setting the locale shell variables) didn't work for me.

Otherwise, it's may be a Perl issue indeed.
sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski »

Hi All

I realize this thread is a bit old now, but I figure it might save someone googling all day (like me :|).
Every version of ZoneMinder I used/tried had this exact problem.
Today I was thinking, maybe “distro”…maybe “perl”…."BUGGER! - server thinks it’s on a permeant holiday USA/Canada without me":(

ZoneMinder rocks & thankyou for a fantastic application.

Steve

===============================================================================================================================

Howto – hope it helps someone

If your email time filters are incorrect with Zoneminder,it's a problem with Date::Manip. (timezones)
This fix might help. In my case I use SME Server 7.2 and it had no timezone entry, therefore defaulting to USA/Canada. (-0500 Central Daylight)
I've just hardcoded it ("AEST" for me, Australian Eastern Standard) into my Manip.pm.

NOTE: you need to adjust for daylight saving time when it arrives.

find Manip.pm
# locate Manip.pm

fire up your fav editor (my path)
# pico /usr/lib/perl5/vendor_perl/5.8.5/Date/Manip.pm

search for
# Local timezone
$Cnf{"TZ"}="";


edit and save with your timezone from the list below.
# Local timezone
$Cnf{"TZ"}="AEST";


Definition of time zones
A time zone item specifies an international time zone, indicated by a small set of letters.
Military time zone designations use a single letter (except j). Zulu Time (z) is Greenwich Mean Time (GMT).
Here are the most common standard-time time zones, indexed by the zone hour value.

"idlw -1200 ". # International Date Line West
"nt -1100 ". # Nome
"hst -1000 ". # Hawaii Standard
"cat -1000 ". # Central Alaska
"ahst -1000 ". # Alaska-Hawaii Standard
"akst -0900 ". # Alaska Standard
"yst -0900 ". # Yukon Standard
"hdt -0900 ". # Hawaii Daylight
"akdt -0800 ". # Alaska Daylight
"ydt -0800 ". # Yukon Daylight
"pst -0800 ". # Pacific Standard
"pdt -0700 ". # Pacific Daylight
"mst -0700 ". # Mountain Standard
"mdt -0600 ". # Mountain Daylight
"cst -0600 ". # Central Standard
"cdt -0500 ". # Central Daylight
"est -0500 ". # Eastern Standard
"act -0500 ". # Brazil, Acre
"sat -0400 ". # Chile
"bot -0400 ". # Bolivia
"amt -0400 ". # Brazil, Amazon
"acst -0400 ". # Brazil, Acre Daylight
"edt -0400 ". # Eastern Daylight
"ast -0400 ". # Atlantic Standard
"nst -0330 ". # Newfoundland Standard nst=North Sumatra +0630
"nft -0330 ". # Newfoundland
"gst -0300 ". # Greenland Standard gst=Guam Standard +1000
"bst -0300 ". # Brazil Standard bst=British Summer +0100
"brt -0300 ". # Brazil Standard (official time)
"brst -0300 ". # Brazil Standard
"adt -0300 ". # Atlantic Daylight
"art -0300 ". # Argentina
"amst -0300 ". # Brazil, Amazon Daylight
"ndt -0230 ". # Newfoundland Daylight
"brst -0200 ". # Brazil Daylight (official time)
"fnt -0200 ". # Brazil, Fernando de Noronha
"at -0200 ". # Azores
"wat -0100 ". # West Africa
"fnst -0100 ". # Brazil, Fernando de Noronha Daylight
"gmt +0000 ". # Greenwich Mean
"ut +0000 ". # Universal
"utc +0000 ". # Universal (Coordinated)
"wet +0000 ". # Western European
"cet +0100 ". # Central European
"fwt +0100 ". # French Winter
"met +0100 ". # Middle European
"mez +0100 ". # Middle European
"mewt +0100 ". # Middle European Winter
"swt +0100 ". # Swedish Winter
"bst +0100 ". # British Summer bst=Brazil standard -0300
"gb +0100 ". # GMT with daylight savings
"west +0000 ". # Western European Daylight
"eet +0200 ". # Eastern Europe, USSR Zone 1
"cest +0200 ". # Central European Summer
"fst +0200 ". # French Summer
"ist +0200 ". # Israel standard
"mest +0200 ". # Middle European Summer
"mesz +0200 ". # Middle European Summer
"metdst +0200 ". # An alias for mest used by HP-UX
"sast +0200 ". # South African Standard
"sst +0200 ". # Swedish Summer sst=South Sumatra +0700
"bt +0300 ". # Baghdad, USSR Zone 2
"eest +0300 ". # Eastern Europe Summer
"eetedt +0300 ". # Eastern Europe, USSR Zone 1
"idt +0300 ". # Israel Daylight
"msk +0300 ". # Moscow
"eat +0300 ". # East Africa
"it +0330 ". # Iran
"zp4 +0400 ". # USSR Zone 3
"msd +0400 ". # Moscow Daylight
"zp5 +0500 ". # USSR Zone 4
"ist +0530 ". # Indian Standard
"zp6 +0600 ". # USSR Zone 5
"novst +0600 ". # Novosibirsk time zone, Russia
"nst +0630 ". # North Sumatra nst=Newfoundland Std -0330
"sst +0700 ". # South Sumatra, USSR Zone 6 sst=Swedish Summer +0200
"javt +0700 ". # Java
"hkt +0800 ". # Hong Kong
"sgt +0800 ". # Singapore
"cct +0800 ". # China Coast, USSR Zone 7
"awst +0800 ". # Australian Western Standard
"wst +0800 ". # West Australian Standard
"pht +0800 ". # Asia Manila
"kst +0900 ". # Republic of Korea
"jst +0900 ". # Japan Standard, USSR Zone 8
"rok +0900 ". # Republic of Korea
"acst +0930 ". # Australian Central Standard
"cast +0930 ". # Central Australian Standard
"aest +1000 ". # Australian Eastern Standard
"east +1000 ". # Eastern Australian Standard
"gst +1000 ". # Guam Standard, USSR Zone 9 gst=Greenland Std -0300
"acdt +1030 ". # Australian Central Daylight
"cadt +1030 ". # Central Australian Daylight
"aedt +1100 ". # Australian Eastern Daylight
"eadt +1100 ". # Eastern Australian Daylight
"idle +1200 ". # International Date Line East
"nzst +1200 ". # New Zealand Standard
"nzt +1200 ". # New Zealand
"nzdt +1300 ". # New Zealand Daylight

Military Time Zones
The hourly zones are used by the military are referred to by a letter of the alphabet (or their phonetic equivalent).
The letter J is not used.
"z +0000 ".
"a +0100 b +0200 c +0300 d +0400 e +0500 f +0600 g +0700 h +0800 ".
"i +0900 k +1000 l +1100 m +1200 ".
"n -0100 o -0200 p -0300 q -0400 r -0500 s -0600 t -0700 u -0800 ".
"v -0900 w -1000 x -1100 y -1200";
====================================================================================================
Locked