since we switched to proxmox_time::strftime_local for printing the start
and end times using local time, the strftime functions in src/time.rs is
unused and can be removed
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
since we now calculate the time in UTC rather than local time, the time
values of each test had to be touched. those should differ by `E10`
(3600 seconds) in most cases since we set the TZ to Europe/Vienna for
the tests.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
`expected` and `command` are more helpful than `new` and `old`.
the order of `expected` and `command` should now always be the same:
expected before command
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
The compatibility code was added to the new rfc3339 code path temporarily so
that the old code path would not be changed before the PMG 8 release.
Now move it to the old time format code to make sure the rfc3339 code path
works as expected. Since we have all the information we need (year, month,
day, hours, minutes, seconds, timezone), there's no need for a workaround in
this code path.
As a side effect of parsing the time format `YYYY-MM-DD HH:MM:SS` in
localtime, it's now possible to parse an rfc3339 compliant format
(except for fractional seconds).
The change needs to be accompanied by one in pmg-api MailTracker.pmg to
keep the time displayed in the GUI the same for the old time format, and
correct for the new rfc3339 format.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Instead of upgrading from clap3 to clap4 (which seems to change their
interface every year or so), switch to the much smaller pico-args. (Same
as we did for termproxy recently, see [0])
It has almost all features we need (except producing help output) and
supports OsString, but wihout any dependencies. This decreases compile
time and reduces the size of the resulting binary. It also reduces the
lines of code.
The only difference is now the different output for errors, e.g. for
missing values of options.
Help output is copied from the old clap output.
0: https://git.proxmox.com/?p=pve-xtermjs.git;a=commitdiff;h=24d707d0506b120a085b06b5f2b6000696879a1e
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
The API assumes the timestamps to be in the local timezone rather than
UTC. It then subtracts the timezone offset leading to wrong values when
timestamps are in UTC, but timezone is not.
For compatibility, add the local timezone to those timestamps.
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
for this test `faketime` is not required since the year is part of the
timestamp
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Adds `proxmox-time` as dependency to parse the timestamp
Since parse_rfc3339 can't handle microseconds, we try to remove the dot
followed by 6 digits of microseconds before passing it to parse_rfc3339.
A fallback to the previous format is used when when it fails to parse
the new format.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
this was dropped when changing to debcargo, but d/docs still
references it.
Without this patch building with sbuild does not work.
Fixes: e029c60dff
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
noticed when building with sbuild, which uses UTC as timezone:
Due to the parsing of traditional syslog time information (which does
not contain timezone information) the testcases passing
unix-timestamps as arguments failed.
Explicitly setting TZ to Europe/Vienna fixes the tests (and makes the
assumption visible)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
only relevant change is the assertion that multiple(true) takes a
value, so we need to change to the new actions system.
Note that with 3.2.20+ we could switch to args.get_count("verbose")
saving us the unwrap/dereference dance.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
We're using a very old version of it and the functions we
actually use are available in glibc anyway.
The only difference I found was that the result of
glibc's `strptime()`'s `%s` does *not* want an additional
`.to_local()` call anymore...
... which was weird anyway.
As a minor optimization I pass the format string as `&CStr`
to avoid the memcpy.
(The CString::new() call in `strptime()` only happens during
parameter parsing)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
[dropped left-over and fixed FIXME]
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
the changes introduced in 1cdbebe57b
changed the date handling to have current_month and current_year
represent the month and year at time of invocation.
This change was not carried over to the logfile collecting, which set
the current month to january.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
rather start with the current time at invocation and if the month in
the log is larger assume a year-wrap happened between logwriting and
invocation.
the old logic is flawed (but that can be said about parsing
traditional syslog timestamps (w/o year) in general) - it got worse
with the change in bullseye of rotating syslog weekly by default -
resulting in users losing one week of logs per day in the new year as
reported in https://forum.proxmox.com/threads/.102322/
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
We only compared the filter `to` with the Noqueue `to` when both were
not empty, and in turn set the nq.dstatus to DStatus::Invalid when they
didn't match.
But in the case of an empty Noqueue `to`, we have to skip it as well if
the filter `to` is not empty.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>