Thursday, September 23, 2010

File Management

http://msdn.microsoft.com/en-us/library/aa364232(v=VS.85).aspx

FindNextFile()


PathFindExtension()

C++ Macros

http://www.ebyte.it/library/codesnippets/WritingCppMacros.html

Nice description and examples.

Wednesday, September 15, 2010

MSBuild Command Line Reference

http://msdn.microsoft.com/en-us/library/ms164311.aspx

SYSTEMTIME Structure

 http://msdn.microsoft.com/en-us/library/ms724950(VS.85).aspx
 typedef struct _SYSTEMTIME {   WORD wYear;   WORD wMonth;   WORD wDayOfWeek;   WORD wDay;   WORD wHour;   WORD wMinute;   WORD wSecond;   WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME;
 

fmod

http://www.cplusplus.com/reference/clibrary/cmath/fmod/

     double fmod (      double numerator,      double denominator );       float fmod (       float numerator,       float denominator ); long double fmod ( long double numerator, long double denominator );
 

COleDatTime::COleDateTime

For older unmanaged code this handles the DATE type.



 COleDateTime( ) throw( );  COleDateTime(    const VARIANT& varSrc  ) throw( ); COleDateTime(    DATE dtSrc  ) throw( ); COleDateTime(    time_t timeSrc  ) throw( ); COleDateTime(    __time64_t timeSrc  ) throw( ); COleDateTime(    const SYSTEMTIME& systimeSrc  ) throw( ); COleDateTime(    const FILETIME& filetimeSrc  ) throw( ); COleDateTime(    int nYear,    int nMonth,    int nDay,    int nHour,    int nMin,    int nSec  ) throw( ); COleDateTime(    WORD wDosDate,    WORD wDosTime  ) throw( ); COleDateTime(       const DBTIMESTAMP& dbts ) throw();
 

Re: Time DBTIMESTAMP

 http://msdn.microsoft.com/en-us/library/c3zzz087(v=VS.80).aspx
 Function for getting the DBTIMESTAMP.
 bool GetAsDBTIMESTAMP(       DBTIMESTAMP& dbts ) const throw();

On Wed, Sep 15, 2010 at 9:41 AM, Stan Hughes <hughes.stan@gmail.com> wrote:

The fraction time is from 0 to 999,999,999.

Not really sure what good this does since you can only get it for the current time and any translation of time rounds to the nearest second.

DBTIMESTAMP

The DBTIMESTAMP structure typedef is defined as follows:

 typedef struct tagDBTIMESTAMP {     SHORT  year;     USHORT month;     USHORT day;     USHORT hour;     USHORT minute;     USHORT second;     ULONG  fraction } DBTIMESTAMP; 

Members

year
The year (0 to 9999) is measured from 0 A.D.
month
The month ranges from 1 to 12 representing January through December.
day
The day ranges from 1 to a maximum of 31, depending on the number of days in the month.
hour
The hour ranges from 0 to 23.
minute
The minute ranges from 0 to 59.
second
The second ranges from 0 to 59.
fraction
The fraction represents billionths of a second ranging from 0 to 999,999,999.

Time DBTIMESTAMP


The fraction time is from 0 to 999,999,999.

Not really sure what good this does since you can only get it for the current time and any translation of time rounds to the nearest second.

DBTIMESTAMP

The DBTIMESTAMP structure typedef is defined as follows:

 typedef struct tagDBTIMESTAMP {     SHORT  year;     USHORT month;     USHORT day;     USHORT hour;     USHORT minute;     USHORT second;     ULONG  fraction } DBTIMESTAMP; 

Members

year
The year (0 to 9999) is measured from 0 A.D.
month
The month ranges from 1 to 12 representing January through December.
day
The day ranges from 1 to a maximum of 31, depending on the number of days in the month.
hour
The hour ranges from 0 to 23.
minute
The minute ranges from 0 to 59.
second
The second ranges from 0 to 59.
fraction
The fraction represents billionths of a second ranging from 0 to 999,999,999.

Tuesday, September 7, 2010

DATE Delta

#include <FLOAT.H> // for the FLT_EPSILON unmanaged code

DATE date1;
DATE date2;

DATE dEpsilon = date1 - date2;

if (dEpsilon > FLT_EPSILON)
{
   COleDateTime clTempEpsilon (depsilon);
   CString strEpsilon = clTempEpsilon.Format("%H:%M:%S %m/%d%Y");
   TRACE (strEpsilon);
}

OLE Date/Time

http://www.newobjects.com/pages/ndl/SQLite2\SQL-OleDate.htm

Related to SQL.

Starts from 30 December 1899 00:00:00


It would seem that the newer, OLD DB Date/Time, SQL Server 2008 R2, support milliseconds.

'yyyy-mm-dd hh:mm:ss[.999]

The time structure is has greater resolution:

'hh:mm:ss[.9999999]


Time Management, Conversion of system time to CTime


CTime Class

8 bytes, with an upper limit of January 18, 2038.


Time Management

#define _BASE_YEAR 70L /* 1970 is the base year */
#define _MAX_YEAR 138: /* 2038 is the max year */

Note that the _make__time64_t() function insist that the year is between 1969 and 2038.  If it is not a error value of 22 is set and a value of -1 is returned.

This is slight inconsistent with the behavior of CTime which set the time to 1970 is the time is earlier than 1900 and than creates the CTime from system time with no error.

This is a know bug.

atltime.inl

if (sysTime.wYear < 1900)
{
   __time64_t time0 = 0L;
   CTime timeT(time0);
   ...
}
else
{
   CTime timeT(
      (int) sysTime.wYear, (int)sysTime,wMonth, (int) sysTime.wDay,
      (int) sysTime.wHour, (int)sysTime.wMinute, (int) sysTime,wSecond,
      nDST);
   ...
}

The SYSTEMTIME structure does have milliseconds, but it is not used by CTime.

::VariantTimeToSystemTime() also seem to be dropping the milliseconds.

Friday, September 3, 2010

Registering and Unregistering COM DLLs

http://support.microsoft.com/kb/249873

Regsvr32.exe usage

RegSvr32.exe has the following command-line options:
Regsvr32 [/u] [/n] [/i[:cmdline]] dllname

/u - Unregister server 
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall 
/n - do not call DllRegisterServer; this option must be used with /i 
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)
When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsvr32.exe displays a dialog box that indicates success. If the attempt is unsuccessful, Regsvr32.exe returns an error message. This may include a Win32 error code. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
193625  WinInet error codes (12001 through 12156)
For example, to manually register a Sample.ocx ActiveX control, type the following command at command prompt:
c:\regsvr32.exe sample.ocx