mirror of
https://github.com/winscp/winscp.git
synced 2026-10-28 15:35:08 +03:00
Time constraints can be set to a start of an interval
Source commit: 4d90140e321930199632c63e75f6fc0db70b092e
This commit is contained in:
@@ -1719,27 +1719,52 @@ bool __fastcall TryRelativeStrToDateTime(UnicodeString S, TDateTime & DateTime,
|
||||
}
|
||||
S.Delete(1, Index - 1);
|
||||
S = S.Trim().UpperCase();
|
||||
bool Start = !S.IsEmpty() && EndsStr(L"S", S);
|
||||
if (Start)
|
||||
{
|
||||
S.SetLength(S.Length() - 1);
|
||||
}
|
||||
DateTime = Now();
|
||||
// These may not overlap with ParseSize (K, M and G)
|
||||
if (S == "S")
|
||||
{
|
||||
DateTime = IncSecond(DateTime, Number);
|
||||
if (Start)
|
||||
{
|
||||
DateTime = IncMilliSecond(DateTime, -static_cast<int>(MilliSecondOfTheSecond(DateTime)));
|
||||
}
|
||||
}
|
||||
else if (S == "N")
|
||||
{
|
||||
DateTime = IncMinute(DateTime, Number);
|
||||
if (Start)
|
||||
{
|
||||
DateTime = IncMilliSecond(DateTime, -static_cast<int>(MilliSecondOfTheMinute(DateTime)));
|
||||
}
|
||||
}
|
||||
else if (S == "H")
|
||||
{
|
||||
DateTime = IncHour(DateTime, Number);
|
||||
if (Start)
|
||||
{
|
||||
DateTime = IncMilliSecond(DateTime, -static_cast<int>(MilliSecondOfTheHour(DateTime)));
|
||||
}
|
||||
}
|
||||
else if (S == "D")
|
||||
{
|
||||
DateTime = IncDay(DateTime, Number);
|
||||
if (Start)
|
||||
{
|
||||
DateTime = IncMilliSecond(DateTime, -static_cast<int>(MilliSecondOfTheDay(DateTime)));
|
||||
}
|
||||
}
|
||||
else if (S == "Y")
|
||||
{
|
||||
DateTime = IncYear(DateTime, Number);
|
||||
if (Start)
|
||||
{
|
||||
DateTime = IncMilliSecond(DateTime, -MilliSecondOfTheYear(DateTime));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user