DS1904 is an iButton RTC equipped with a 32-bit RTC counter with a resolution of 1 second. This counter can accumulate 136 years of seconds before rolling over. Time/date is represented by the number of seconds since a reference point, which is determined by the user. For example, January 1st, 1970 at 0:00:00 could be a reference. Therefore, to write the current time, you would first need to calculate how many seconds the current time is away from the reference time (e.g January 1st, 1970 at 0:00:00). It should then be converted into 4 bytes of hexadecimal data to be written into the corresponding memory. When you read the time, it is also the seconds that have elasped relative to the reference time and needs to be converted to get the actual time.