MCPcopy Create free account
hub / github.com/KDE/kdevelop / parse

Method parse

plugins/lldb/formatters/qt.py:854–883  ·  view source on GitHub ↗

Copied from Qt srources

(julianDay)

Source from the content-addressed store, hash-verified

852
853 @staticmethod
854 def parse(julianDay):
855 """Copied from Qt srources"""
856 if julianDay == 0:
857 return None
858 if julianDay >= 2299161:
859 # Gregorian calendar starting from October 15, 1582
860 # This algorithm is from Henry F. Fliegel and Thomas C. Van Flandern
861 ell = julianDay + 68569
862 n = (4 * ell) / 146097
863 ell = ell - (146097 * n + 3) / 4
864 i = (4000 * (ell + 1)) / 1461001
865 ell = ell - (1461 * i) / 4 + 31
866 j = (80 * ell) / 2447
867 d = ell - (2447 * j) / 80
868 ell = j / 11
869 m = j + 2 - (12 * ell)
870 y = 100 * (n - 49) + i + ell
871 else:
872 # Julian calendar until October 4, 1582
873 # Algorithm from Frequently Asked Questions about Calendars by Claus Toendering
874 julianDay += 32082
875 dd = (4 * julianDay + 3) / 1461
876 ee = julianDay - (1461 * dd) / 4
877 mm = ((5 * ee) + 2) / 153
878 d = ee - (153 * mm + 2) / 5 + 1
879 m = mm + 3 - 12 * (mm / 10)
880 y = dd - 4800 + (mm / 10)
881 if y <= 0:
882 return None
883 return dt.date(y, m, d)
884
885 def _update(self):
886 # FIXME: Calling functions returns incorrect SBValue for complex type in lldb

Callers 4

_updateMethod · 0.95
QDateSummaryProviderFunction · 0.45
QTimeSummaryProviderFunction · 0.45
QDateTimeSummaryProviderFunction · 0.45

Calls 1

dateMethod · 0.45

Tested by

no test coverage detected