I wear Xiaomi's Amazfit Pro 3R. Digital. Wrist band. Hung at midnight of 29th Feb today. Did a bunch of factory reset but didn't recover. And then recovered at the morning of 1st of March.
Date is relatively simple.
days_in_month(year, month) :
if(month==2) return days_in_feb(year)
//all other months have constant number of days, always.
days_in_feb(year,month) :
if(!(year % 400)) return 29;
if(!(year % 100)) return 28;
if(!(year % 4)) return 29;
return 28;
Date is relatively simple.
And you are done for all Gregorian years.