[p4] P4COM.DLL

Dix, John JDix at MedManageSystems.com
Tue Dec 11 09:55:07 PST 2007


Hello all,

 

I just rebuilt the code project P4COM.dll for VS.NET 2005 and the only
thing I had to change was the function p4::FormatDateTime() to support
the long datetime structure:

STDMETHODIMP p4::FormatDateTime(long unixtime, BSTR *pVal)

{

    TCHAR buf[100];

      struct tm newtime;

    __time64_t long_time = unixtime;

    errno_t err;

 

    // Convert to local time.

      if (err = _localtime64_s(&newtime, &long_time))

            return EINVAL;

      wsprintf(buf, _T("%04d/%02d/%02d %02d:%02d:%02d"),

            newtime.tm_year+1900, newtime.tm_mon+1, newtime.tm_mday,

            newtime.tm_hour, newtime.tm_min, newtime.tm_sec);

      CComBSTR f = buf;

      *pVal = f.Detach();

      return S_OK;

}

 

I just started using it and wanted to see if anyone has run into
gothcha's or issues with it. I wanted to save myself some time and
possible frustration. J

 

Thanks!

-jdix



More information about the perforce-user mailing list