Project

General

Profile

Actions

Bug #14854

open
CM

WTime::toString with Format "+hh:mm": "+" is treated as literal

Bug #14854: WTime::toString with Format "+hh:mm": "+" is treated as literal

Added by Christian Meyer 5 days ago. Updated 1 day ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
10/01/2026
Due date:
% Done:

0%

Estimated time:

Description

addNew<Wt::WText>(Wt::WTime(0,0).addSecs(45*60).toString("+hh:mm"));
addNew<Wt::WText>(Wt::WTime(0,0).addSecs(-45*60).toString("+hh:mm"));

results in +00:45+00:45

Unless this is desired behaviour?

Wt 4.14.2 & 4.14.4


Files

wt_WTime_negative.patch (4.24 KB) wt_WTime_negative.patch Christian Meyer, 10/05/2026 03:57 PM

RM Updated by Romain Mardulyn 5 days ago Actions #1

  • Target version set to 4.16.0

CM Updated by Christian Meyer 1 day ago Actions #2

WTime can never be negative for times lower than 1 hour ...

because only the sign of the hour is checked...

I added an internal bool that tracks sign and use that for +- range output

updated setHMS to check every value for negativity, std::abs the value and keep the tracking.

Also adjusted ALL the constructors and from... Handlers to incorporate negative values or set negative after using setHMS, to enable signed updates with setHMS.

Additionally WtSqlTraits for Time also did not support negative values ...

updated Dbo::Impl::msecsToHMS to return negative values.

Actions

Also available in: PDF Atom