summaryrefslogtreecommitdiff
path: root/src/simple_time.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-06 13:34:23 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-06 13:34:23 +1100
commit8f2f6a5e2074a5da684f9f1a5f5e8f3c51a82b76 (patch)
tree2b11d86d759867e35db6489743355d2761c5bb53 /src/simple_time.adb
parentc2f324ac23ea143dfea308229f0ac0376ed4f745 (diff)
More or less completed main procedure, fixed some bugs
Diffstat (limited to 'src/simple_time.adb')
-rw-r--r--src/simple_time.adb18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/simple_time.adb b/src/simple_time.adb
index cf1995c..1b10dc8 100644
--- a/src/simple_time.adb
+++ b/src/simple_time.adb
@@ -17,13 +17,19 @@ package body Simple_Time is
Hours : Integer := Integer (Raw_Secs) / 3600;
Minutes : Integer := (Integer (Raw_Secs) - Hours * 3600) / 60;
Seconds : Duration := Raw_Secs - Duration (Hours) * 3600 - Duration (Minutes) * 60;
+
+ Year_Str : String (1 .. 4);
+ Month_Str, Day_Str, Hour_Str, Minute_Str : String (1 .. 2);
+ Second_Str : String (1 .. 12);
begin
- return Trim (Year_Number'Image (Year (Moment)), Both) & "-" &
- Trim (Month_Number'Image (Month (Moment)), Both) & "-" &
- Trim (Day_Number'Image (Day (Moment)), Both) & " " &
- Trim (Integer'Image (Hours), Both) & ":" &
- Trim (Integer'Image (Minutes), Both) & ":" &
- Trim (Duration'Image (Seconds), Both);
+ Move (Trim (Year_Number'Image (Year (Moment)), Left), Year_Str, Left, Right, '0');
+ Move (Trim (Month_Number'Image (Month (Moment)), Left), Month_Str, Left, Right, '0');
+ Move (Trim (Day_Number'Image (Day (Moment)), Left), Day_Str, Left, Right, '0');
+ Move (Trim (Integer'Image (Hours), Left), Hour_Str, Left, Right, '0');
+ Move (Trim (Integer'Image (Minutes), Left), Minute_Str, Left, Right, '0');
+ Move (Trim (Duration'Image (Seconds), Left), Second_Str, Left, Right, '0');
+ return Year_Str & '-' & Month_Str & '-' & Day_Str & " " &
+ Hour_Str & ':' & Minute_Str & ':' & Second_Str;
end To_String;