-
Notifications
You must be signed in to change notification settings - Fork 1
Class_SNTP
Ko-ichiro Sugiyama edited this page Mar 6, 2023
·
6 revisions
WLAN クラスでネットワーク接続することが前提
コンストラクタの中で,SNTP サーバへの接続と時刻取得の両方を行う.
例
sntp = SNTP.new( mode )
sntp.set
sntp.str_date #=> 2022-01-02
sntp.str_time #=> 22:10:33
sntp.str_datetime #=>20220102221033
sntp.datetime #=>[2022, 1, 2, 22, 10, 33]
例
puts sprintf("%04d-%02d-%02d %02d:%02d:%02d", time.year, time.mon, time.mday, time.hour, time.min, time.sec)