From a8b8c6b5fdb7cc6a1aa884db31f88aa87e0cd3f2 Mon Sep 17 00:00:00 2001 From: stan Date: Fri, 11 Jul 2003 09:37:01 +0000 Subject: [PATCH] Changed to not use from_unixtime in time calculations. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@629 e3e1d417-86f3-4887-817a-d78f3d33393f --- scripts/zmfilter.pl.z | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/zmfilter.pl.z b/scripts/zmfilter.pl.z index 097d14c19..450c13f2f 100755 --- a/scripts/zmfilter.pl.z +++ b/scripts/zmfilter.pl.z @@ -330,32 +330,32 @@ sub GetFilters { if ( $filter_terms{$attr_name} eq 'DateTime' ) { - my $dt_val = strtotime( $filter_terms{$value_name} ); + my $dt_val = strftime( "%Y-%m-%d %H:%M:%S", strtotime( $filter_terms{$value_name} ) ); if ( !$dt_val ) { printf( STDERR "Error, unable to parse date '$filter_terms{$value_name}', skipping\n" ); next FILTER; } - $filter_sql .= "E.StartTime ".$filter_terms{$op_name}." from_unixtime( $dt_val )"; + $filter_sql .= "E.StartTime ".$filter_terms{$op_name}." '$dt_val'"; # Indicate that this filter uses dates and so should not be dependant on the event id $filter_data->{has_dates} = !undef; } elsif ( $filter_terms{$attr_name} eq 'Date' ) { - my $dt_val = strtotime( $filter_terms{$value_name} ); - $filter_sql .= "to_days( E.StartTime ) ".$filter_terms{$op_name}." to_days( from_unixtime( $dt_val ) )"; + my $dt_val = strftime( "%Y-%m-%d %H:%M:%S", strtotime( $filter_terms{$value_name} ) ); + $filter_sql .= "to_days( E.StartTime ) ".$filter_terms{$op_name}." to_days( '$dt_val' )"; # Indicate that this filter uses dates and so should not be dependant on the event id $filter_data->{has_dates} = !undef; } elsif ( $filter_terms{$attr_name} eq 'Time' ) { - my $dt_val = strtotime( $filter_terms{$value_name} ); - $filter_sql .= "extract( hour_second from E.StartTime ) ".$filter_terms{$op_name}." extract( hour_second from from_unixtime( $dt_val ) )"; + my $dt_val = strftime( "%Y-%m-%d %H:%M:%S", strtotime( $filter_terms{$value_name} ) ); + $filter_sql .= "extract( hour_second from E.StartTime ) ".$filter_terms{$op_name}." extract( hour_second from '$dt_val' )"; } elsif ( $filter_terms{$attr_name} eq 'Weekday' ) { - my $dt_val = strtotime( $filter_terms{$value_name} ); - $filter_sql .= "weekday( E.StartTime ) ".$filter_terms{$op_name}." weekday( from_unixtime( $dt_val ) )"; + my $dt_val = strftime( "%Y-%m-%d %H:%M:%S", strtotime( $filter_terms{$value_name} ) ); + $filter_sql .= "weekday( E.StartTime ) ".$filter_terms{$op_name}." weekday( '$dt_val' )"; } elsif ( $filter_terms{$attr_name} eq 'Archived' ) {