ConnectSDK / Connect-SDK-Android-Core

Core source code for the Android Connect SDK project
Apache License 2.0
114 stars 79 forks source link

"hh:mm:ss" should be "HH:mm:ss" or it will have trouble with 12 hours of videos. #40

Closed casolorz closed 9 years ago

casolorz commented 9 years ago

The code below on DLNAService works fine except for 12 hours of video. It considers 12 to be zero because hh is used instead of HH.

 private long convertStrTimeFormatToLong(String strTime) {
        long time = 0;
        SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss");

        try {
            Date d = df.parse(strTime);
            Date d2 = df.parse("00:00:00");

            time = d.getTime() - d2.getTime();
        } catch (ParseException e) {
//            e.printStackTrace();
            Log.w("Connect SDK", "Invalid Time Format: " + strTime);
            return 0;
        }

        return time;
    }
oleksii-frolov commented 9 years ago

Thanks. It was fixed here https://github.com/ConnectSDK/Connect-SDK-Android-Core/commit/d52ac44291d954dcf30f1bb19f5edef72b6edb78