We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8840604 commit 44c445cCopy full SHA for 44c445c
1 file changed
src/uing/tm.cr
@@ -79,20 +79,18 @@ module UIng
79
80
# Convert TM to Time with error handling
81
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
+ ::Time.local(
+ year + 1900, # tm_year is years since 1900
+ mon + 1, # tm_mon is 0-based (0-11)
+ mday,
+ hour,
+ min,
+ sec,
+ nanosecond: 0
+ )
+ rescue
+ # Fallback to current time if conversion fails
+ ::Time.local
96
end
97
98
# Delegate to_s to Time for convenient formatting
0 commit comments