Skip to content

Commit 44c445c

Browse files
committed
Removed begin
1 parent 8840604 commit 44c445c

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

src/uing/tm.cr

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,18 @@ module UIng
7979

8080
# Convert TM to Time with error handling
8181
def to_time : ::Time
82-
begin
83-
::Time.local(
84-
year + 1900, # tm_year is years since 1900
85-
mon + 1, # tm_mon is 0-based (0-11)
86-
mday,
87-
hour,
88-
min,
89-
sec,
90-
nanosecond: 0
91-
)
92-
rescue e
93-
# Fallback to current time if conversion fails
94-
::Time.local
95-
end
82+
::Time.local(
83+
year + 1900, # tm_year is years since 1900
84+
mon + 1, # tm_mon is 0-based (0-11)
85+
mday,
86+
hour,
87+
min,
88+
sec,
89+
nanosecond: 0
90+
)
91+
rescue
92+
# Fallback to current time if conversion fails
93+
::Time.local
9694
end
9795

9896
# Delegate to_s to Time for convenient formatting

0 commit comments

Comments
 (0)