We remove miliseconds from datetime.
This commit is contained in:
Louis Rossouw
2015-08-29 02:41:47 +02:00
parent 88fbb6ecc9
commit 408b8dd855

View File

@@ -195,18 +195,24 @@ poller_group = ('and poller_group IN({0}) '
# Add last_polled and last_polled_timetaken so we can sort by the time the last poll started, with the goal # Add last_polled and last_polled_timetaken so we can sort by the time the last poll started, with the goal
# of having each device complete a poll within the given time range. # of having each device complete a poll within the given time range.
dev_query = ('SELECT device_id, status, ' dev_query = ('SELECT device_id, status, '
'CAST( '
' DATE_ADD( ' ' DATE_ADD( '
' DATE_SUB( ' ' DATE_SUB( '
' last_polled, ' ' last_polled, '
' INTERVAL last_polled_timetaken SECOND ' ' INTERVAL last_polled_timetaken SECOND '
' ), ' ' ), '
' INTERVAL {0} SECOND) AS next_poll, ' ' INTERVAL {0} SECOND) '
' AS DATETIME(0) '
') AS next_poll, '
'CAST( '
' DATE_ADD( ' ' DATE_ADD( '
' DATE_SUB( ' ' DATE_SUB( '
' last_discovered, ' ' last_discovered, '
' INTERVAL last_discovered_timetaken SECOND ' ' INTERVAL last_discovered_timetaken SECOND '
' ), ' ' ), '
' INTERVAL {1} SECOND) AS next_discovery ' ' INTERVAL {1} SECOND) '
' AS DATETIME(0) '
') as next_discovery '
'FROM devices WHERE ' 'FROM devices WHERE '
'disabled = 0 ' 'disabled = 0 '
'AND IS_FREE_LOCK(CONCAT("polling.", device_id)) ' 'AND IS_FREE_LOCK(CONCAT("polling.", device_id)) '