add zero padding to clock

This commit is contained in:
Crispy 2021-05-16 01:20:46 +02:00
parent 2f1bc9d9c1
commit 553a5c65b8
2 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,24 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../builds/ovr-utils.x86_64"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=true
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true

View file

@ -5,4 +5,11 @@ func _ready() -> void:
pass
func _process(delta: float) -> void:
text = "%s:%s" % [OS.get_time().hour, OS.get_time().minute]
_update_time()
func _update_time():
var h = str(OS.get_time().hour)
var m = str(OS.get_time().minute)
h = h if len(h) == 2 else "0" + h
m = m if len(m) == 2 else "0" + m
text = "%s:%s" % [h, m]