I use System.currentTimeMillis() to save the time a user starts an activity.
public class TimeStamp {
protected long _startTimeMillis = System.currentTimeMillis();
public String getStartTime() {
return new Time(_startTimeMillis).toString();
}
the class is instantiated when activity is started and getStartTime() returns the correct time. I also try to get the time that has passed after the activity has been started.
public String getElapsedTime() {
return new Time(System.currentTimeMillis() - _startTimeMillis).toString();
}
This works perfectly fine using an emulated android device (android 4.0.3). But when I deploy the application on my real android device (android 4.0.3) getElapsedTime() starts with one additional hour and then counts up normally. So on my real device getElapsedTime() will return "01:00:01" after the activity was started, but it should return "00:00:01".
Do you have any ideas why this happens?