Skip to content
Snippets Groups Projects
Commit d0db42a5 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Module Time: Add short_format

parent 0e461311
No related branches found
No related tags found
No related merge requests found
......@@ -503,6 +503,7 @@ class ModuleTime: Module
{
StatusBar bar;
string format;
string shortFormat;
Color color;
bool refresh;
int round_ms;
......@@ -510,6 +511,7 @@ class ModuleTime: Module
{
bar = _bar;
format = section.Optional("format")?.AsString() ?? "yyyy-MM-dd HH:mm:ss";
shortFormat = section.Optional("shortFormat")?.AsString();
DateTime.Now.ToString(format);
color = section["color"]?.AsColor() ?? Color.White;
refresh = section.Optional("refresh")?.AsBool() ?? false;
......@@ -525,7 +527,7 @@ class ModuleTime: Module
string shortText = shortFormat==null?null:t.ToString(shortFormat);
if(refresh)
bar.Schedule((int)(round_ms - t_ms % round_ms + 1));
return new Element[]{new Element(s, Color: color)};
return new Element[]{new Element(s, Color: color, ShortText: shortText)};
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment