Arch Chinese lists the meanings of 子 as
son, seed, egg, child, small thing, noun suffix(zi5), midnight, Kangxi radical number 39, 1st terrestrial branch
The meanings of child, egg, diminutive noun suffix etc. are clearly related, but I find it hard to remember that this also means midnight (in particular in the Korean 자정/子正).
How does 子 come to mean 'midnight'? Is it related to the fact that it also stands for '1st terrestrial branch'?