public static long updateSmscTimestampDrift(Context context,long timestamp,long smscTimestamp){
  final int thirtyMins=30 * 60 * 1000;
  long timeDrift=0;
  final long timeDiff30Mins=Math.round((smscTimestamp - timestamp) / thirtyMins);
  if (Math.abs(timeDiff30Mins) > 0) {
    timeDrift=timeDiff30Mins * thirtyMins;
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor=prefs.edit();
    editor.putLong(ManagePreferences.SMSC_TIME_DRIFT,timeDrift);
    editor.commit();
  }
  return timeDrift;
}

public static long updateSmscTimestampDrift ( Context context , long timestamp , long smscTimestamp ) { final int thirtyMins = 30 * 60 * 1000 ; long timeDrift = 0 ; final long timeDiff30Mins = Math . round ( ( smscTimestamp - timestamp ) / thirtyMins ) ; if ( Math . abs ( timeDiff30Mins ) > 0 ) { timeDrift = timeDiff30Mins * thirtyMins ; SharedPreferences prefs = PreferenceManager . getDefaultSharedPreferences ( context ) ; Editor editor = prefs . edit ( ) ; editor . putLong ( ManagePreferences . SMSC_TIME_DRIFT , timeDrift ) ; editor . commit ( ) ; } return timeDrift ; }
yet another hack to work with the undocumented sms apis . some devices ( and it seems to be those running on cdma networks ) store a timestamp that is off by several hours - it seems to be related to how the carrier sets up the sms service center . this method checks for substantial drift ( 30mins + ) and stores a preference to indicate this which can be used later to display the correct timestamp to the user .
