There are several RTC chips from Maxim/Dallas Semiconductor. Several of these use either SPI or I2C interface. This is the easiest way to add RTC to the 8051. The small RTC chip uses a 32kHZ crystal and often also has a separate battery input for use when the 8051 is not running.