curioustechizen / android-ago

An Android TextView that always displays an auto refreshing relative time span with respect to a reference time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time is one hour behind on old Galaxy Tab 3 using Android 4.4.2

erikswed opened this issue · comments

HI and thanks for grate lib.
Using 'com.github.curioustechizen.android-ago:library:1.3.4' and XML looks like:

     <com.github.curioustechizen.ago.RelativeTimeTextView
                android:id="@+id/timestamp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="2dp"
                android:layout_marginRight="2dp"
                tools:text="Just Now"/>

The time is always one hour behind. The device clock is set correctly.
I am in Sweden btw. What do you think? In Sweden we have summer time adjustment that mean during summer time is set forward one hour. It feels like your lib dont take that into consideration since the time I see on the Galaxy tab 3 is normal European time(correct time) (but it will for me in Sweden be one our behind)( We do this time thing to get more daylight sunlight)
https://www.timeanddate.com/time/change/sweden/malmo

I have also a Galaxy Note 4 running android 6.0.1 and time is correct all ok

@erikswed The library does not calculate the time, we just use DateUtils. Could you try creating a simple app using getRelativeTimeSpanString(long, long, long, int) from that class and see what it prints?

@erikswed Have you gotten a chance to try out the DateUtils class yet?

UPDATE:
It was my tablet kitkat Galaxy Tab 3 that need a system reset I think because everything look ok on the Android emulator api19 kitkat

Hmm
I cant figure this out right away very strange. I do as you say creating a test project here is the relevant code

        Long mReferenceTime = 1509262481035L; // 14 minutes ago
        RelativeTimeTextView timestampView1 = findViewById(R.id.timestamp1);
        TextView timestampView2 = findViewById(R.id.timestamp2);

        timestampView1.setReferenceTime(mReferenceTime);
        long now = System.currentTimeMillis();
        long difference = now - mReferenceTime;

        timestampView2.setText(DateUtils.getRelativeTimeSpanString(mReferenceTime,
                now,
                DateUtils.MINUTE_IN_MILLIS,
                DateUtils.FORMAT_ABBREV_RELATIVE));

The timestamp1 and timestamp2 show the same mReferenceTime and on Api23 time is correct but on the Galaxy Tab 3 using Android 4.4.2 time is one hour behind.
There´s is something obvious I have missed!
Must google this for an answer.. what you think?