Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config_version=5
[application]

config/name="FINI Clock"
run/main_scene="res://scenes/main.tscn"
config/features=PackedStringArray("4.5", "Mobile")
config/icon="res://icon.svg"

Expand Down
12 changes: 12 additions & 0 deletions scenes/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://cmgtipf2pqvpl"]

[ext_resource type="Script" uid="uid://c1bhwqlkyejjc" path="res://scripts/main.gd" id="1_main_script"]

[node name="main_node" type="Node2D"]
script = ExtResource("1_main_script")

[node name="time_label" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0
theme_override_font_sizes/font_size = 80
text = "99:99"
15 changes: 15 additions & 0 deletions scripts/main.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends Node2D

@onready var time_label = $time_label

func _ready():
update_time()

func _process(_delta):
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating the time display every frame is inefficient since the display only shows hours and minutes. Consider using a Timer node that triggers every second or minute instead of updating in _process().

Suggested change
update_time()
func _process(_delta):
update_time()
var timer := Timer.new()
timer.wait_time = 1.0
timer.one_shot = false
timer.autostart = true
add_child(timer)
timer.timeout.connect(_on_time_timer_timeout)
func _process(_delta):
pass
func _on_time_timer_timeout():

Copilot uses AI. Check for mistakes.
update_time()

func update_time():
var time_dict = Time.get_time_dict_from_system(true) # true for UTC
var hours = time_dict.hour
var minutes = time_dict.minute
time_label.text = "%02d:%02d" % [hours, minutes]
1 change: 1 addition & 0 deletions scripts/main.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://c1bhwqlkyejjc
Loading