String Lat = tmplist[1];
String lon = tmplist[3];
String fixed = tmplist[6];
+ String utctime = tmplist[5];
+ try {
+ TimeUtil.sGpsTime = utctime.substring(0, 6);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
// ICLogger.i("GPGLL Lat="+Lat+",Lon="+lon+",fixed="+fixed);
} else if (nmeastr.startsWith("$GPRMC,") || nmeastr.startsWith("$GNRMC,")) {
String lon = tmplist[5];
String fixed = tmplist[2];
String speed = tmplist[7];
+ String date = tmplist[9];
+ try {
+ TimeUtil.sGpsTime = utctime.substring(0, 6);
+ TimeUtil.sGpsDate = date;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
// ICLogger.i("GPRMC GPSTime="+utctime+",Lat="+Lat+",Lon="+lon+",fixed="+fixed+",speed="+speed);
// if (Config.LOG_TOFILE)
// FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "GPRMC GPSTime="+utctime+",Lat="+Lat+",Lon="+lon+",fixed="+fixed+",speed="+speed);
String fixed = tmplist[6];
String usedStarts = tmplist[7];
String hdop = tmplist[8];
-
+ try {
+ TimeUtil.sGpsTime = utctime.substring(0, 6);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
if ((fixed.trim().equals("1")) || (fixed.trim().equals("2")) || (fixed.trim().equals("6"))) {
import android.app.AlarmManager;
import android.content.Context;
-import android.os.Handler;
import android.provider.Settings;
import android.text.format.DateFormat;
import android.util.Log;
import com.ic.iclooger.ICLogger;
-import java.sql.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
return (new SimpleDateFormat("HHmmss")).format(new Date(System.currentTimeMillis()));
}
+ //这个是GPS的时间,修改位置在NMEAListener上
+ public static String sGpsDate = "220101";
+
public static String getUTCSystemDateYYMMDD() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyMMdd");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
+ //如果当前的时间是2022年以前的,那么就使用GPS的时间
+ if (System.currentTimeMillis() < 1640966400000L) {
+ return sGpsDate;
+ }
return simpleDateFormat.format(new Date());
}
+ //这个时间在NMEAListener里修改,GPS的时间
+ public static String sGpsTime = "000000";
+
public static String getUTCSystemTimeHHmmss() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HHmmss");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
+ if (System.currentTimeMillis() < 1640966400000L) {
+ return sGpsTime;
+ }
String format = simpleDateFormat.format(new Date());
ICLogger.d("getUTCSystemTimeHHmmss ==> " + format);
return format;