1. Good that OP is using 4 simplifications: year 2000-2099, no DST, no leap second, no timezone. So OP knows of code limitations concerning these. Various elements of this function break without those givens. 2. Make `static unsigned short days` a `const`. 3. Use a `long` for your epoch as in: void epoch_to_date_time(date_time_t* date_time,unsigned long epoch) as `unsigned` is only guaranteed to range form 0 to at least 65535 which is insufficient here. 4. For various functions, consider adding `const`. There are pros and cons to this, but may be beneficial in your case: // unsigned int date_time_to_epoch(date_time_t* date_time) unsigned int date_time_to_epoch(const date_time_t* date_time) 5. There exist equation based (non-loop) solutions to the year-day that do not need a table like your `unsigned short days[4][12]`. Code then looks more complicated, but is faster. Please advise if interested. 6. Most of the magic numbers like 60, 24 are so well-known that constant or macro substitution seems superfluous. But `(365*4+1)` may benefit with something like "DaysPer4Years".