--------------------------------------------------------------------------- Modified Julian Date
| 891 | //--------------------------------------------------------------------------- |
| 892 | //Modified Julian Date |
| 893 | std::string Date_MJD(uint16_t Date_) |
| 894 | { |
| 895 | //Calculating |
| 896 | double Date = Date_; |
| 897 | if ((Date_ & 0x8000) == 0) |
| 898 | Date += 0x10000; // adjust the MJD to support dates beyond the 16 bit rollover in 2038 |
| 899 | int Y2 = (int)((Date - 15078.2) / 365.25); |
| 900 | int M2 = (int)(((Date - 14956.1) - ((int)(Y2 * 365.25))) / 30.6001); |
| 901 | int D = (int)(Date - 14956 - ((int)(Y2 * 365.25)) - ((int)(M2 * 30.6001))); |
| 902 | int K = 0; |
| 903 | if (M2 == 14 || M2 == 15) |
| 904 | K = 1; |
| 905 | int Y = Y2 + K; |
| 906 | int M = M2 - 1 - K * 12; |
| 907 | |
| 908 | //Formatting |
| 909 | return to_string(1900 + Y) + '-' |
| 910 | + (M < 10 ? "0" : "") + to_string(M) + '-' |
| 911 | + (D < 10 ? "0" : "") + to_string(D); |
| 912 | } |
| 913 | |
| 914 | //--------------------------------------------------------------------------- |
| 915 | //Form: HHMMSS, BCD |
no test coverage detected