login about faq

Hi! I'm getting the validity information from a PFX certificate, and when I read the date using the conversion to UTC, the value of UTC is incorrect. Expected is -3, but CkDateTime is returning -2. In the operating system, GMT is -3.

My test code:

#include <iostream>
#include <string>

#include "CkCert.h"
#include "CkString.h"
#include "CkDateTime.h"

#define PATH_CERT "cert.pfx"
#define PASS_CERT "pass"

int main(void)
{
    CkCert* certificado = new CkCert();
    if (!certificado->LoadPfxFile(PATH_CERT, PASS_CERT))
    {
        std::cout << certificado->lastErrorText() << std::endl;
        delete certificado;
        return -1;
    }

    CkDateTime* certDtFrom;
    certDtFrom = certificado->GetValidFromDt();

    CkString* ckStr = new CkString();
    certDtFrom->GetAsRfc822(true, *ckStr);

    std::string valid(ckStr->getStringAnsi());
    std::cout << valid << std::endl;

    delete ckStr;
    delete certDtFrom;
    delete certificado;

    return 0;
}

asked Mar 23 '17 at 14:53

Alexandre%20Iwts's gravatar image

Alexandre Iwts
33


When you get the local date/time for some date in the future (or some date in the past), the offset from GMT that you should see is the offset with Daylight Saving Time applied for that particular date/time, not for whatever exists right now.

For example, when Daylight Saving Time is in effect, the Eastern US timezone is UTC-4h, but when Daylight Saving Time is NOT in effect, the offset is UTC-5h.

link

answered Mar 23 '17 at 21:23

chilkat's gravatar image

chilkat ♦♦
12.8k318388550

Thanks !!!

(Mar 24 '17 at 08:33) Alexandre Iwts
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:

×85
×4
×3

Asked: Mar 23 '17 at 14:53

Seen: 653 times

Last updated: Mar 24 '17 at 08:33

powered by OSQA