[bTSstream-devel] [Git][videolan/bitstream][master] 2 commits: Fix rounding error in dvb_mjd_get()

Christophe Massiot gitlab at videolan.org
Fri Mar 1 14:02:42 CET 2019


Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
cd1438b3 by Eric Petit at 2019-02-28T21:02:52Z
Fix rounding error in dvb_mjd_get()

It could cause Mar 1 to be misinterpreted as Feb 32, which timegm()
then transforms into Mar 4 (only on some years, including 2019)

- - - - -
3147f766 by Christophe Massiot at 2019-03-01T13:02:30Z
Merge branch 'titer-master'

- - - - -


1 changed file:

- dvb/si/datetime.h


Changes:

=====================================
dvb/si/datetime.h
=====================================
@@ -60,7 +60,7 @@ static inline void dvb_mjd_get(uint16_t mjd, int *y, int *m, int *d)
 {
     int k;
     int yp = (mjd * 20 - 301564) / 7305;
-    int mp = (mjd * 10000 - 149561000 - yp * 3652500) / 306001;
+    int mp = (mjd * 10000 - 149561000 - 10000 * (yp * 1461 / 4)) / 306001;
     *d = mjd - 14956 - yp * 1461 / 4 - mp * 306001 / 10000;
     k = (mp == 14 || mp == 15) ? 1 : 0;
     *y = yp + k;



View it on GitLab: https://code.videolan.org/videolan/bitstream/compare/356989cf468735d71046bc7f9f45a7537aedf38c...3147f766a6e4a9b9bc07ef2b555bc0aed952b671

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/compare/356989cf468735d71046bc7f9f45a7537aedf38c...3147f766a6e4a9b9bc07ef2b555bc0aed952b671
You're receiving this email because of your account on code.videolan.org.


More information about the biTStream-devel mailing list