Browse Source

Make the time parameter for Adapter-based sources work exactly the same as for non-Adapter-based sources.

master
Michael Uleysky 4 weeks ago
parent
commit
8832ff7232
  1. 21
      src/Adapter.cpp

21
src/Adapter.cpp

@ -19,8 +19,27 @@ Error Adapter::FilterTimes(const CLArgs& args, michlib_internal::ParameterListEx
MDateTime time;
MString t = args.at("time");
if(time.FromString(t) || t == "BEGIN" || t == "BEG" || t == "FIRST" || t == "END" || t == "LAST") // Time, not regex
if(t == "BEGIN" || t == "BEG" || t == "FIRST")
t = times.front().ToTString();
else if(t == "END" || t == "LAST")
t = times.back().ToTString();
else if(time.FromString(t)) // Time, not regex
{
if(time <= times.front())
t = times.front().ToTString();
else if(time >= times.back())
t = times.back().ToTString();
else
for(size_t i = 0; i < times.size() - 1; i++)
{
if(time >= times[i] && time <= times[i + 1])
{
t = times[(time - times[i] <= times[i + 1] - time) ? i : (i + 1)].ToTString();
break;
}
}
tb = te = t;
}
else // Regular expression
tf = t;
}

Loading…
Cancel
Save