Discuss Scratch
- Discussion Forums
- » Show and Tell
- » Accurate Digital Clock (UTC & JST with Milliseconds!) / 正確なデジタル時計(UTC・JST・ミリ秒対応)
- sumiccorn
-
Scratcher
18 posts
Accurate Digital Clock (UTC & JST with Milliseconds!) / 正確なデジタル時計(UTC・JST・ミリ秒対応)
Hello! I made an accurate real-time digital clock supporting both UTC and JST (down to 2-digit milliseconds) using the
(こんにちは!「2000年からの日数」ブロックを使って、UTCとJSTを2桁ミリ秒までリアルタイム表示する正確なデジタル時計を作りました!)
▶ Accurate Digital Clock (UTC & JST) / 正確なデジタル時計
■ Key Features / 工夫したポイント
• Accurately calculates JST (+9 hours) by adding +0.375 days to “days since 2000”
(+0.375日=9時間の計算で時差を正確に再現)
• Renders digital numbers smoothly using 30 clones
(30個のクローンを使ってデジタル数字を描画)
• Aligns digits cleanly by padding minutes, seconds, and milliseconds with “0”, and hours with a space
(桁がズレないように、分・秒・ミリ秒は「0」、時は「スペース」で文字数を揃えました)
■ Main Calculation Script / メインの計算スクリプト
Feel free to check it out and share your feedback!(ぜひ見てみてください!)
*Please check #2 for the topic rules! / ルールは#2を確認してください!
(days since 2000 :: sensing)block!
(こんにちは!「2000年からの日数」ブロックを使って、UTCとJSTを2桁ミリ秒までリアルタイム表示する正確なデジタル時計を作りました!)
▶ Accurate Digital Clock (UTC & JST) / 正確なデジタル時計
■ Key Features / 工夫したポイント
• Accurately calculates JST (+9 hours) by adding +0.375 days to “days since 2000”
(+0.375日=9時間の計算で時差を正確に再現)
• Renders digital numbers smoothly using 30 clones
(30個のクローンを使ってデジタル数字を描画)
• Aligns digits cleanly by padding minutes, seconds, and milliseconds with “0”, and hours with a space
(桁がズレないように、分・秒・ミリ秒は「0」、時は「スペース」で文字数を揃えました)
■ Main Calculation Script / メインの計算スクリプト
when green flag clicked :: events
クローン生成 :: custom
forever :: control
set [日付 v] to (days since 2000 :: sensing) :: variables
set [UTC時 v] to (([floor v] of ((日付 :: variables) * (24) :: operators) :: operators) mod (24) :: operators) :: variables
set [JST時 v] to (([floor v] of (((日付 :: variables) + (0.375) :: operators) * (24) :: operators) :: operators) mod (24) :: operators) :: variables
set [分 v] to (([floor v] of (((日付 :: variables) * (1440) :: operators) mod (60) :: operators) :: operators) :: variables
set [秒 v] to (([floor v] of (((日付 :: variables) * (86400) :: operators) mod (60) :: operators) :: operators) :: variables
set [ミリ秒 v] to (([floor v] of (((日付 :: variables) * (8640000) :: operators) mod (100) :: operators) :: operators) :: variables
if <(UTC時 :: variables) < [10] :: operators> then :: control
set [UTC時 v] to (join [ ] (UTC時 :: variables) :: operators) :: variables
end
if <(JST時 :: variables) < [10] :: operators> then :: control
set [JST時 v] to (join [ ] (JST時 :: variables) :: operators) :: variables
end
if <(分 :: variables) < [10] :: operators> then :: control
set [分 v] to (join [0] (分 :: variables) :: operators) :: variables
end
if <(秒 :: variables) < [10] :: operators> then :: control
set [秒 v] to (join [0] (秒 :: variables) :: operators) :: variables
end
if <(ミリ秒 :: variables) < [10] :: operators> then :: control
set [ミリ秒 v] to (join [0] (ミリ秒 :: variables) :: operators) :: variables
end
set [UTC結果 v] to (join [UTC ] (join (UTC時 :: variables) (join [:] (join (分 :: variables) (join [:] (join (秒 :: variables) (join [.] (ミリ秒 :: variables) :: operators) :: operators) :: operators) :: operators) :: operators) :: operators) :: operators) :: variables
set [JST結果 v] to (join [JST ] (join (JST時 :: variables) (join [:] (join (分 :: variables) (join [:] (join (秒 :: variables) (join [.] (ミリ秒 :: variables) :: operators) :: operators) :: operators) :: operators) :: operators) :: operators) :: operators) :: variables
end
define クローン生成
go to x: (100) y: (17.5) :: motion
set [クローン# v] to (30) :: variables
repeat (15) :: control
create clone of (myself v) :: control
change [クローン# v] by (-1) :: variables
end
go to x: (100) y: (-17.5) :: motion
repeat (15) :: control
create clone of (myself v) :: control
change [クローン# v] by (-1) :: variables
end
when I start as a clone :: control
show :: looks
forever :: control
set x to (((100) - ((((クローン# :: variables) - (1) :: operators) mod (15) :: operators) * (18) :: operators) :: operators) * (-1) :: operators) :: motion
switch costume to (letter (クローン# :: variables) of (join (UTC結果 :: variables) (JST結果 :: variables) :: operators) :: operators) :: looks
end
Feel free to check it out and share your feedback!(ぜひ見てみてください!)
*Please check #2 for the topic rules! / ルールは#2を確認してください!
Last edited by sumiccorn (Dec. 4, 2026 11:58:41)
- sumiccorn
-
Scratcher
18 posts
Accurate Digital Clock (UTC & JST with Milliseconds!) / 正確なデジタル時計(UTC・JST・ミリ秒対応)
■ Topic Rules / トピックのルール
• Stay on topic (clocks only).
時計に関係ないことは話さないでください。
• Analog clocks are also welcome!
時計ならばアナログ時計でもOKです。
• Only discuss projects made with Scratch or TurboWarp (pure HTML/etc. is not allowed).
Scratch、TurboWarpで作るもののみ話してください(HTML単体などはダメです)。
• Converting Scratch or TurboWarp code to HTML/JS/CSS (or vice versa) is OK!
Scratch、TurboWarpのコードを元にしてHTMLやJS、CSSなどで動くコードや、その逆はOKです。
• Do not post in Japanese only — please include English, and mix in Japanese so Japanese Scratchers can understand too!
日本語のみで送信しないでください。日本人にも分かるように日本語を交えてください。
• Up to 100 images per post, and maximum image size is 3840x2160 per image (must use Scratch-approved image hosts).
画像は1投稿につき100枚まで、最大サイズは1枚あたり3840x2160までです(※Scratch公式許可の画像アップローダーを使用してください)。
• Report inappropriate posts to the Scratch Team (ST). Do not abuse the report button.
適切でない投稿はScratchチームに報告してください。報告の乱用は禁止です。
• Note: The rules for this topic start from #2 (this post).
このトピックはここ(#2)からルールが書かれています。
• Stay on topic (clocks only).
時計に関係ないことは話さないでください。
• Analog clocks are also welcome!
時計ならばアナログ時計でもOKです。
• Only discuss projects made with Scratch or TurboWarp (pure HTML/etc. is not allowed).
Scratch、TurboWarpで作るもののみ話してください(HTML単体などはダメです)。
• Converting Scratch or TurboWarp code to HTML/JS/CSS (or vice versa) is OK!
Scratch、TurboWarpのコードを元にしてHTMLやJS、CSSなどで動くコードや、その逆はOKです。
• Do not post in Japanese only — please include English, and mix in Japanese so Japanese Scratchers can understand too!
日本語のみで送信しないでください。日本人にも分かるように日本語を交えてください。
• Up to 100 images per post, and maximum image size is 3840x2160 per image (must use Scratch-approved image hosts).
画像は1投稿につき100枚まで、最大サイズは1枚あたり3840x2160までです(※Scratch公式許可の画像アップローダーを使用してください)。
• Report inappropriate posts to the Scratch Team (ST). Do not abuse the report button.
適切でない投稿はScratchチームに報告してください。報告の乱用は禁止です。
• Note: The rules for this topic start from #2 (this post).
このトピックはここ(#2)からルールが書かれています。
Last edited by sumiccorn (Yesterday 04:06:01)
- sumiccorn
-
Scratcher
18 posts
Accurate Digital Clock (UTC & JST with Milliseconds!) / 正確なデジタル時計(UTC・JST・ミリ秒対応)
This is the very first topic created by sumiccorn!
スミコーンの立てた初めてのトピックです!
News / お知らせ
This topic has been added to The Official Show and Tell Directory II (under “A”)! Thanks to ScodexPerson for adding it!
このトピックが「The Official Show and Tell Directory II」(公式ディレクトリ)の「A」の欄に掲載されました!追加してくれたScodexPersonさんに感謝します!
新しくコーンペンゲージ系列のトピックを立てました!
スミコーンの立てた初めてのトピックです!
News / お知らせ
This topic has been added to The Official Show and Tell Directory II (under “A”)! Thanks to ScodexPerson for adding it!
このトピックが「The Official Show and Tell Directory II」(公式ディレクトリ)の「A」の欄に掲載されました!追加してくれたScodexPersonさんに感謝します!
新しくコーンペンゲージ系列のトピックを立てました!
Last edited by sumiccorn (Yesterday 00:13:45)
- Discussion Forums
- » Show and Tell
-
» Accurate Digital Clock (UTC & JST with Milliseconds!) / 正確なデジタル時計(UTC・JST・ミリ秒対応)