summaryrefslogtreecommitdiff
path: root/net/sntp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sntp.c')
-rw-r--r--net/sntp.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/net/sntp.c b/net/sntp.c
index 73d1d87d38b..77cee0046bd 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -57,8 +57,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
unsigned src, unsigned len)
{
struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;
- struct rtc_time tm;
- ulong seconds;
+ u32 seconds;
debug("%s\n", __func__);
@@ -69,24 +68,8 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
* As the RTC's used in U-Boot support second resolution only
* we simply ignore the sub-second field.
*/
- memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
-
- rtc_to_tm(ntohl(seconds) - 2208988800UL + net_ntp_time_offset, &tm);
-#ifdef CONFIG_DM_RTC
- struct udevice *dev;
- int ret;
-
- ret = uclass_get_device(UCLASS_RTC, 0, &dev);
- if (ret)
- printf("SNTP: cannot find RTC: err=%d\n", ret);
- else
- dm_rtc_set(dev, &tm);
-#elif defined(CONFIG_CMD_DATE)
- rtc_set(&tm);
-#endif
- printf("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
- tm.tm_year, tm.tm_mon, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec);
+ memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(seconds));
+ net_sntp_set_rtc(ntohl(seconds) - 2208988800UL + net_ntp_time_offset);
net_set_state(NETLOOP_SUCCESS);
}