From 3e0edfabc603ce556c6079aaebf7d0494536dd63 Mon Sep 17 00:00:00 2001 From: Jiri Kostiha Date: Tue, 19 Nov 2024 18:14:28 +0100 Subject: [PATCH] refactor: PERIOD to timespan --- src/SyncAPIConnector/codes/PERIOD.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SyncAPIConnector/codes/PERIOD.cs b/src/SyncAPIConnector/codes/PERIOD.cs index b4226af..84ca342 100644 --- a/src/SyncAPIConnector/codes/PERIOD.cs +++ b/src/SyncAPIConnector/codes/PERIOD.cs @@ -1,3 +1,4 @@ +using System; using System.Globalization; namespace Xtb.XApi.Codes; @@ -29,8 +30,11 @@ public PERIOD(int code) { } - /// Converts to human friendly string. - public string? ToFriendlyString() => + /// Converts to TimeSpan. + public TimeSpan ToTimeSpan() => TimeSpan.FromMinutes(Code); + + /// Converts to Alphanumeric Time Interval Notation string. + public string? ToAtin() => Code switch { M1_CODE => "M1",