Buggy code:
private static boolean isRunning = false ; private boolean enabled = true ; private boolean mapMode = false ; HashSet < PointOfInterest > notifiedPOIs = new HashSet < PointOfInterest > ( ) ; ArrayList < Messenger > mClients = new ArrayList < Messenger > ( ) ; int mValue = 0 ; public static final int MSG_REGISTER_CLIENT = 1 ; public static final int MSG_UNREGISTER_CLIENT = 2 ; public static final int MSG_LOCATIONS_UPDATED = 3 ; public static final int MSG_KEYWORDS_UPDATED = 4 ; public static final int MSG_TASKS_UPDATED = 5 ; public static final int MSG_QUERY_ENABLED = 6 ; public static final int MSG_ENABLE = 7 ; public static final int MSG_DISABLE = 8 ; public static final int MSG_MAP_MODE_ENABLE = 9 ; public static final int MSG_MAP_MODE_DISABLE = 10 ; final Messenger mMessenger = new Messenger ( new ToDoMeService . IncomingHandler ( ) ) ; private Handler timedTasksHandler = new Handler ( ) ; @ Override public IBinder onBind ( Intent intent ) { } @ Override public void onCreate ( ) { } private void setLocationUpdateSettings ( ) { } private void readTasks ( ) { } private void writeTasks ( ArrayList < Task > newTasks ) { } private void readKeywords ( ) { } private void writeKeywords ( KeywordDatabase newKeywords ) { } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { } @ Override public void onDestroy ( ) { } private void showNotification ( ArrayList < Task > notifyTasks , PointOfInterest poi ) { } private void showNotification ( Task notifyTask , PointOfInterest poi ) { } public static boolean isRunning ( ) { } private void getKeywordDatabaseFromServer ( ) { } private LocationDatabase getLocationDatabase ( GeoPoint point , int radius , String type ) { } private boolean updateDatabase ( HashSet < String > taskTypes ) { } void checkForReleventNotifications ( ) { Log . i ( TAG , "Checking<seq2seq4repair_space>for<seq2seq4repair_space>relevent<seq2seq4repair_space>notifications" ) ; if ( ! ( updateDatabase ( getAllTaskTypes ( ) ) ) ) { Log . w ( TAG , "checkForReleventNotifications<seq2seq4repair_space>errored,<seq2seq4repair_space>falling<seq2seq4repair_space>back<seq2seq4repair_space>to<seq2seq4repair_space>old<seq2seq4repair_space>database" ) ; if ( ( pointsOfInterest ) == null ) { Log . w ( TAG , "pointsOfInterest<seq2seq4repair_space>==null<seq2seq4repair_space>aswell,<seq2seq4repair_space>giving<seq2seq4repair_space>up" ) ; } } if ( ( userCurrentLocation ) != null ) { LocationDatabase locDb = pointsOfInterest . findPointsWithinRadius ( Util . locationToGeoPoint ( userCurrentLocation ) , 0.1 ) ; for ( Iterator < PointOfInterest > iter = locDb . iterator ( ) ; iter . hasNext ( ) ; ) { PointOfInterest poi = iter . next ( ) ; if ( ! ( notifiedPOIs . contains ( poi ) ) ) { ArrayList < Task > releventTasks = Util . getReleventTasks ( tasks , poi ) ; boolean mutipleNotifications = false ; if ( mutipleNotifications ) { for ( Iterator < Task > taskIter = releventTasks . iterator ( ) ; taskIter . hasNext ( ) ; ) { showNotification ( taskIter . next ( ) , poi ) ; notifiedPOIs . add ( poi ) ; } } else { if ( ( releventTasks . size ( ) ) > 0 ) { showNotification ( releventTasks , poi ) ; notifiedPOIs . add ( poi ) ; } else { Log . e ( TAG , "getReleventTasks<seq2seq4repair_space>has<seq2seq4repair_space>returned<seq2seq4repair_space>0,<seq2seq4repair_space>this<seq2seq4repair_space>should<seq2seq4repair_space>not<seq2seq4repair_space>happen!" ) ; } } } else { Log . i ( TAG , ( ( ( ( "Not<seq2seq4repair_space>notifying<seq2seq4repair_space>for<seq2seq4repair_space>" + ( poi . getLatitudeE6 ( ) ) ) + "<seq2seq4repair_space>" ) + ( poi . getLongitudeE6 ( ) ) ) + "<seq2seq4repair_space>as<seq2seq4repair_space>it<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>notified<seq2seq4repair_space>for<seq2seq4repair_space>in<seq2seq4repair_space>this<seq2seq4repair_space>location<seq2seq4repair_space>already" ) ) ; } } } else { Log . w ( TAG , "Cant<seq2seq4repair_space>check<seq2seq4repair_space>for<seq2seq4repair_space>location<seq2seq4repair_space>triggered<seq2seq4repair_space>notifications<seq2seq4repair_space>as<seq2seq4repair_space>userCurrentLocation==null" ) ; } Log . i ( TAG , "Begining<seq2seq4repair_space>to<seq2seq4repair_space>check<seq2seq4repair_space>timed<seq2seq4repair_space>tasks" ) ; for ( Iterator < Task > tasksIter = tasks . iterator ( ) ; tasksIter . hasNext ( ) ; ) { Task task = tasksIter . next ( ) ; Time taskTime = task . getAlarmTime ( ) ; if ( taskTime != null ) { Time currentTime = new Time ( ) ; currentTime . set ( System . currentTimeMillis ( ) ) ; Log . i ( TAG , ( ( ( ( ( ( ( "Task<seq2seq4repair_space>" + ( task . getName ( ) ) ) + "<seq2seq4repair_space>has<seq2seq4repair_space>a<seq2seq4repair_space>alarm<seq2seq4repair_space>time<seq2seq4repair_space>of<seq2seq4repair_space>" ) + ( taskTime . hour ) ) + ":" ) + ( taskTime . minute ) ) + ":" ) + ( taskTime . second ) ) ) ; Log . i ( TAG , ( ( ( ( ( "Current<seq2seq4repair_space>time<seq2seq4repair_space>is<seq2seq4repair_space>" + ( currentTime . hour ) ) + ":" ) + ( currentTime . minute ) ) + ":" ) + ( currentTime . second ) ) ) ; <START_BUG> if ( ( ( System . currentTimeMillis ( ) ) - ( taskTime . toMillis ( false ) ) ) > ( - 1000 ) ) { <END_BUG> Log . i ( TAG , "Putting<seq2seq4repair_space>up<seq2seq4repair_space>notification<seq2seq4repair_space>for<seq2seq4repair_space>timed<seq2seq4repair_space>task" ) ; showNotification ( task , null ) ; } else { Log . i ( TAG , "Regiestering<seq2seq4repair_space>call<seq2seq4repair_space>back" ) ; timedTasksHandler . removeCallbacks ( mUpdateTimeTask ) ; timedTasksHandler . postDelayed ( mUpdateTimeTask , taskTime . toMillis ( false ) ) ; } } } } private Runnable mUpdateTimeTask = new Runnable ( ) { public void run ( ) { } } ; private void updateNotifiedPOIs ( ) { } HashSet < String > getAllTaskTypes ( ) { } class IncomingHandler extends Handler { @ Override public void handleMessage ( Message msg ) { } } private void sendQueryResponse ( ) { } private void sendDatabaseToUI ( LocationDatabase db ) { } private void sendMessageToUI ( String value ) { } private void sendMessageToUI ( int msgType ) { } public void onLocationChanged ( Location location ) { } public void onProviderDisabled ( String provider ) { } public void onProviderEnabled ( String provider ) { } public void onStatusChanged ( String provider , int status , Bundle extras ) { } private void disableNotifications ( ) { } private void enableNotifications ( ) { } }

Fix:
if ( ( ( ( System . currentTimeMillis ( ) ) - ( taskTime . toMillis ( false ) ) ) > ( - 1000 ) ) && ( ( ( System . currentTimeMillis ( ) ) - ( taskTime . toMillis ( false ) ) ) < 1000 ) ) {