@@ -14,8 +14,6 @@ class WelcomePanel : public Component
1414 , public NVGComponent
1515 , public AsyncUpdater
1616{
17-
18-
1917 class ContentComponent : public Component
2018 {
2119 WelcomePanel& panel;
@@ -585,6 +583,24 @@ class WelcomePanel : public Component
585583
586584 triggerAsyncUpdate ();
587585 }
586+
587+ String getSystemLocalTime (uint64 timestamp) {
588+ StackArray<char , 100 > buffer;
589+ std::time_t now = static_cast <std::time_t >(timestamp / 1000 );
590+ std::tm* localTime = std::localtime (&now);
591+
592+ // Format the time using the current locale
593+ std::strftime (buffer.data (), buffer.size (), " %X" , localTime);
594+
595+ auto result = String::fromUTF8 (buffer.data ());
596+
597+ // Remove seconds from system time format
598+ auto secondsStart = result.lastIndexOfChar (' :' );
599+ auto secondsEnd = result.indexOfChar (secondsStart, ' ' );
600+ if (secondsEnd < 0 ) secondsEnd = result.length ();
601+
602+ return result.substring (0 , secondsStart) + result.substring (secondsEnd);
603+ }
588604
589605 void handleAsyncUpdate () override
590606 {
@@ -632,7 +648,8 @@ class WelcomePanel : public Component
632648 }
633649 }
634650
635- auto openTime = Time (static_cast <int64>(subTree.getProperty (" Time" )));
651+ auto openTimestamp = static_cast <int64>(subTree.getProperty (" Time" ));
652+ auto openTime = Time (openTimestamp);
636653 auto diff = Time::getCurrentTime () - openTime;
637654 String date;
638655 if (diff.inDays () == 0 )
@@ -641,7 +658,8 @@ class WelcomePanel : public Component
641658 date = " Yesterday" ;
642659 else
643660 date = openTime.toString (true , false );
644- String time = openTime.toString (false , true , false , true );
661+
662+ String time = getSystemLocalTime (openTimestamp);
645663 String timeDescription = date + " , " + time;
646664
647665 auto * tile = recentlyOpenedTiles.add (new WelcomePanelTile (*this , patchFile.getFileNameWithoutExtension (), timeDescription, silhoutteSvg, snapshotColour, 1 .0f , favourited, thumbImage));
0 commit comments