login about faq

CkDateTime::DiffSeconds returns 0 when it should have returned a negative value (according to the documentation):

CkDateTime ckdt1, ckdt2;
ckdt1.SetFromTimestamp("2016-01-01T12:00:00Z");
ckdt2.SetFromTimestamp("2017-01-01T12:00:00Z");
auto nSeconds1 = ckdt1.DiffSeconds(ckdt2); // nSeconds1 = 0
auto nSeconds2 = ckdt2.DiffSeconds(ckdt1); // nSeconds2 = 31622400

ckdt1 is obviously older than ckdt2, but does not return -31622400 as expected. No error is returned and put_VerboseLogging/put_DebugLogFilePath/lastErrorText does not indicate any issues.

This has been tested with version 9.5.0.68 of Chilkat C/C++ Libs for VC++ 12.0 XP / win32.

By the way I am missing a simple method to compare dates. Maybe DiffSeconds was meant for that purpose, but counting the exact difference ought to be slower than to simply determine which is newer/older/equal.

asked Jun 12 at 11:27

roan98dk's gravatar image

roan98dk
342192038


I made the fix, but can't produce a new build until late today or tomorrow. I'll post it here.

PS> DiffSeconds is valid for comparing dates. It's not slower than if a method returned true/false.

link

answered Jun 12 at 16:12

chilkat's gravatar image

chilkat ♦♦
12.8k317363471

1

No rush. I won't replace the current build until the next scheduled release.

(Jun 12 at 16:41) roan98dk

Thanks, I'll have a look..

link

answered Jun 12 at 15:55

chilkat's gravatar image

chilkat ♦♦
12.8k317363471

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×3
×2
×1
×1
×1

Asked: Jun 12 at 11:27

Seen: 348 times

Last updated: Jun 13 at 09:13

powered by OSQA