Buggy code:
public class CameAndWentProvider extends ContentProvider { private static final String AUTHORITY = "com.tokko.cameandwent.cameandwent.CameAndWentProvider" ; private static final String URI_TEMPLATE = ( "content:////" + ( CameAndWentProvider . AUTHORITY ) ) + "//" ; private static final String DATABASE_NAME = "cameandwent" ; private static final String TABLE_LOG_NAME = "cameandwent" ; private static final String VIEW_DURATION = "durations" ; public static final String ID = "_id" ; public static final String CAME = "came" ; public static final String WENT = "went" ; public static final String DATE = "date" ; public static final String DURATION = "duration" ; private static final String ACTION_CAME = "ACTION_CAME" ; private static final String ACTION_WENT = "ACTION_WENT" ; private static final String ACTION_GET_LOG_ENTRIES = "ACTION_GET_LOG_ENTRIES" ; private static final String ACTION_DELETE_ALL = "ACTION_DELETE_ALL" ; private static final String ACTION_GET_DETAILS = "ACTION_GET_DETAILS" ; private static final String ACTION_DELETE_DETAIL = "ACTION_DELETE_DETAIL" ; private static final int KEY_CAME = 0 ; private static final int KEY_WENT = 1 ; private static final int KEY_GET_LOG_ENTRIES = 2 ; private static final int KEY_DELETE_ALL = 3 ; private static final int KEY_GET_DETAILS = 4 ; private static final int KEY_DELETE_DETAIL = 4 ; public static final Uri URI_CAME = Uri . parse ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_CAME ) ) ) ; public static final Uri URI_WENT = Uri . parse ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_WENT ) ) ) ; public static final Uri URI_GET_LOG_ENTRIES = Uri . parse ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_GET_LOG_ENTRIES ) ) ) ; public static final Uri URI_DELETE_ALL = Uri . parse ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_DELETE_ALL ) ) ) ; public static final Uri URI_GET_DETAILS = Uri . parse ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_GET_DETAILS ) ) ) ; public static final Uri URI_DELETE_DETAIL = Uri . parse ( ( ( ( CameAndWentProvider . URI_TEMPLATE ) + ( CameAndWentProvider . ACTION_DELETE_DETAIL ) ) + "//#" ) ) ; private static UriMatcher uriMatcher ; private CameAndWentProvider . DatabaseOpenHelper db ; @ Override public boolean onCreate ( ) { } @ Override public Cursor query ( Uri uri , String [ ] projection , String selection , String [ ] selectionArgs , String sortOrder ) { } @ Override public String getType ( Uri uri ) { } @ Override public Uri insert ( Uri uri , ContentValues values ) { SQLiteDatabase sdb = db . getWritableDatabase ( ) ; switch ( CameAndWentProvider . uriMatcher . match ( uri ) ) { case CameAndWentProvider . KEY_CAME : long came = values . getAsLong ( CameAndWentProvider . CAME ) ; Calendar c = Calendar . getInstance ( ) ; c . setTimeInMillis ( came ) ; c . set ( Calendar . MILLISECOND , 0 ) ; c . set ( Calendar . SECOND , 0 ) ; <START_BUG> c . set ( Calendar . HOUR , 0 ) ; <END_BUG> c . set ( Calendar . MINUTE , 0 ) ; values . put ( CameAndWentProvider . DATE , c . getTimeInMillis ( ) ) ; long id = sdb . insert ( CameAndWentProvider . TABLE_LOG_NAME , null , values ) ; if ( id > ( - 1 ) ) { getContext ( ) . getContentResolver ( ) . notifyChange ( CameAndWentProvider . URI_GET_LOG_ENTRIES , null ) ; getContext ( ) . getContentResolver ( ) . notifyChange ( CameAndWentProvider . URI_GET_DETAILS , null ) ; } return ContentUris . withAppendedId ( uri , id ) ; default : throw new IllegalArgumentException ( "Unknown<seq2seq4repair_space>URI" ) ; } } @ Override public int delete ( Uri uri , String selection , String [ ] selectionArgs ) { } @ Override public int update ( Uri uri , ContentValues values , String selection , String [ ] selectionArgs ) { } private class DatabaseOpenHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 19 ; private static final String CREATE = ( ( ( ( ( ( ( ( ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>NOT<seq2seq4repair_space>EXISTS<seq2seq4repair_space>" + ( CameAndWentProvider . TABLE_LOG_NAME ) ) + "(" ) + ( CameAndWentProvider . ID ) ) + "<seq2seq4repair_space>INTEGER<seq2seq4repair_space>PRIMARY<seq2seq4repair_space>KEY,<seq2seq4repair_space>" ) + ( CameAndWentProvider . DATE ) ) + "<seq2seq4repair_space>INTEGER<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL<seq2seq4repair_space>DEFAULT<seq2seq4repair_space>0,<seq2seq4repair_space>" ) + ( CameAndWentProvider . CAME ) ) + "<seq2seq4repair_space>INTEGER<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL," ) + ( CameAndWentProvider . WENT ) ) + "<seq2seq4repair_space>INTEGER<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL<seq2seq4repair_space>DEFAULT<seq2seq4repair_space>0);" ; private static final String DURATION_CALC = ( ( ( ( "(" + ( CameAndWentProvider . WENT ) ) + "-" ) + ( CameAndWentProvider . CAME ) ) + ")<seq2seq4repair_space>AS<seq2seq4repair_space>" ) + ( CameAndWentProvider . DURATION ) ; private static final String CREATE_DURATION_VIEW = ( ( ( ( ( ( ( ( ( ( "CREATE<seq2seq4repair_space>VIEW<seq2seq4repair_space>" + ( CameAndWentProvider . VIEW_DURATION ) ) + "<seq2seq4repair_space>AS<seq2seq4repair_space>SELECT<seq2seq4repair_space>" ) + ( CameAndWentProvider . ID ) ) + ",<seq2seq4repair_space>" ) + ( CameAndWentProvider . DATE ) ) + ",<seq2seq4repair_space>" ) + ( CameAndWentProvider . DatabaseOpenHelper . DURATION_CALC ) ) + "<seq2seq4repair_space>FROM<seq2seq4repair_space>" ) + ( CameAndWentProvider . TABLE_LOG_NAME ) ) + "<seq2seq4repair_space>GROUP<seq2seq4repair_space>BY<seq2seq4repair_space>" ) + ( CameAndWentProvider . DATE ) ; public DatabaseOpenHelper ( Context context ) { } @ Override public void onCreate ( SQLiteDatabase db ) { } @ Override public void onUpgrade ( SQLiteDatabase db , int oldVersion , int newVersion ) { } } }

Fix:
c . set ( Calendar . HOUR_OF_DAY , 0 ) ;