NTP, Network Time Protocol for time synchronization between computer systems over UDP.

The ntp protocol is, according to Wikipedia:

... a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. In operation since before 1985, NTP is one of the oldest Internet protocols in current use. NTP was originally designed by David L. Mills of the University of Delaware, who still oversees its development.

It is the main way - but others do exist - for a network connected device (including Raspberry Pis, which do not have a Real Time Clock built-in) to get and keep the time of day; it can also discipline most locally added RTC modules that might be added to an RPi, to improve their accuracy should one be present.