allow time edits
This commit is contained in:
@ -47,6 +47,18 @@ static func time_to_period(time_in_secs: int) -> String:
|
||||
return "%02d:%02d:%02d" % [hours, minutes, seconds]
|
||||
|
||||
|
||||
static func period_to_time(period_string: String) -> int:
|
||||
var period := period_string.split(":")
|
||||
if period.size() < 3:
|
||||
return -1
|
||||
var hours := int(period[0])
|
||||
var minutes := int(period[1])
|
||||
var seconds := int(period[2])
|
||||
var time := seconds + (minutes * 60) + (hours * 60 * 60)
|
||||
return time
|
||||
|
||||
|
||||
|
||||
func to_csv_line() -> PoolStringArray:
|
||||
return PoolStringArray([
|
||||
name,
|
||||
|
@ -50,5 +50,24 @@ func from_string(time_string: String) -> TimeStamp:
|
||||
return from_dict(time)
|
||||
|
||||
|
||||
func from_unix_time(unix_time: int) -> TimeStamp:
|
||||
var time := Time.get_datetime_dict_from_unix_time(unix_time)
|
||||
return from_dict(time)
|
||||
|
||||
|
||||
func equals(other) -> bool:
|
||||
return (
|
||||
other.year == year and \
|
||||
other.month == month and \
|
||||
other.day == day and \
|
||||
other.weekday == weekday and \
|
||||
other.hour == hour and \
|
||||
other.minute == minute and \
|
||||
other.second == second and \
|
||||
other.unix == unix
|
||||
)
|
||||
|
||||
|
||||
func _to_string() -> String:
|
||||
return Time.get_datetime_string_from_datetime_dict(to_dict(), false)
|
||||
|
||||
|
Reference in New Issue
Block a user