my own kdatetime patches: toString with InvalidOffset; operator==

Jon Severinsson jon at severinsson.net
Fri Oct 26 19:38:14 UTC 2012


fredagen den 26 oktober 2012 19:23:05 skrev  David Faure:
> On Friday 26 October 2012 17:30:56 Jon Severinsson wrote:
> > I'm no expert either, but I have picked up a few things over the last
> > couple of weeks, and IMHO such a KDateTime should be invalid, but not
> > null, and toString should result in a sensible, though invalid, string.
> 
> Sounds sensible, but please note that this isn't what your patch does.
> The unittest still says
>       QVERIFY(dateTimeInvalidTz.isValid());
> therefore "such a KDateTime should be invalid" isn't implemented.

Oups, fixed!
(turns out KTimeZone::currentOffset() returned 0 for some errors and 
KTimeZone::InvalidOffset for some, fixed).

> > I have therefore updated your patch (see attachment) to fix
> > KDateTime::Spec::setType(KTimeZone)  as I proposed, changed the
> > validation check at the top of toString() to "if (!d->dt().isValid())"
> > and adapted your toString() fix to check for  "d->specType == Invalid"
> > (as well as "offset == KTimeZone::InvalidOffset", just in case something
> > has gone wrong with the time zone after the original check).
> > 
> > I also changed "+invalidtz" to "+EINVAL", as I think an error code makes
> > more sence than an non-translatable error text.
> 
> All this sounds good.
> 
> Thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-isValid-and-toString-for-a-KDateTime-constructed.patch
Type: text/x-patch
Size: 3371 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20121026/58b42f9f/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20121026/58b42f9f/attachment-0001.sig>


More information about the Kde-frameworks-devel mailing list