Click here to Skip to main content
15,172,078 members
Home / Discussions / C / C++ / MFC

C / C++ / MFC

SuggestionRe: InitDialog in splitter Pin
David Crow29-Mar-16 10:11
MemberDavid Crow29-Mar-16 10:11 
Questionarduino sensor Pin
Member 1240312128-Mar-16 8:35
MemberMember 1240312128-Mar-16 8:35 
AnswerRe: arduino sensor Pin
David Crow28-Mar-16 10:40
MemberDavid Crow28-Mar-16 10:40 
AnswerRe: arduino sensor Pin
Richard MacCutchan28-Mar-16 22:44
mveRichard MacCutchan28-Mar-16 22:44 
GeneralRe: arduino sensor Pin
Sascha Lefèvre29-Mar-16 0:31
professionalSascha Lefèvre29-Mar-16 0:31 
GeneralRe: arduino sensor Pin
Member 1240312131-Mar-16 0:19
MemberMember 1240312131-Mar-16 0:19 
GeneralRe: arduino sensor Pin
leon de boer3-Apr-16 7:43
Memberleon de boer3-Apr-16 7:43 
QuestionCOleDateTime Pin
Still learning how to code27-Mar-16 10:48
MemberStill learning how to code27-Mar-16 10:48 
I have an application in which time values are transferred byte-by-byte to an Arduino via USB/COM. I have now realised that using CTime objects will suffer from the 19 January 2038 problem where, after this date, GetTime() will return negative values due to the return value being signed. It appears that use of COleDateTime with CTimeSpan ::GetTotalSeconds will avoid this as the return value is an unsigned quantity.
I have now written a bit of test code comparing CTime and the ColeDateTime. /CtimeSpan combination. Whilst the values returned by the various member functions (year, month, etc,etc) all give identical values, the GetTime() and GetTotalSeconds() values differ by 3600 (1 hour)

Here is my test code:-

// ----------------------- CTime operations -------------------------
CTime tNow;
tNow = CTime::GetCurrentTime();	

int iTimeYear = tNow.GetYear(); 
int iTimeMonth = tNow.GetMonth();
int iTimeDay = tNow.GetDay();
int iTimeHour = tNow.GetHour();
int iTimeMinute = tNow.GetMinute();
int iTimeSecond = tNow.GetSecond();

unsigned long ulNow = tNow.GetTime();

// ----------- COleDateTime / CTimeSpan operations  ----------
COleDateTime epoch(1970,1,1,0,0,0);	// 1970 Jan 1 midnight 
COleDateTime tCurrentTime;
tCurrentTime = COleDateTime::GetCurrentTime();

int iOleYear = tCurrentTime.GetYear();
int iOleMonth = tCurrentTime.GetMonth();
int iOleDay = tCurrentTime.GetDay();	
int iOleHour = tCurrentTime.GetHour();
int iOleMinute = tCurrentTime.GetMinute();
int iOleSecond = tCurrentTime.GetSecond();

unsigned long ulOleTime = (unsigned long)(tCurrentTime-epoch).GetTotalSeconds();


AnswerRe: COleDateTime Pin
Serkan Onat27-Mar-16 13:44
professionalSerkan Onat27-Mar-16 13:44 
GeneralRe: COleDateTime Pin
Still learning how to code27-Mar-16 23:11
MemberStill learning how to code27-Mar-16 23:11 
GeneralRe: COleDateTime Pin
Jochen Arndt28-Mar-16 2:50
professionalJochen Arndt28-Mar-16 2:50 
GeneralRe: COleDateTime Pin
Still learning how to code28-Mar-16 23:58
MemberStill learning how to code28-Mar-16 23:58 
GeneralRe: COleDateTime Pin
Jochen Arndt29-Mar-16 0:08
professionalJochen Arndt29-Mar-16 0:08 
QuestionOld code Pin
RomTibi27-Mar-16 10:18
MemberRomTibi27-Mar-16 10:18 
AnswerRe: Old code Pin
Patrice T27-Mar-16 11:46
mvePatrice T27-Mar-16 11:46 
AnswerRe: Old code Pin
Sascha Lefèvre27-Mar-16 13:38
professionalSascha Lefèvre27-Mar-16 13:38 
AnswerRe: Old code Pin
David Crow28-Mar-16 4:55
MemberDavid Crow28-Mar-16 4:55 
SuggestionRe: Old code Pin
Richard MacCutchan28-Mar-16 7:08
mveRichard MacCutchan28-Mar-16 7:08 
AnswerRe: Old code Pin
Richard MacCutchan28-Mar-16 7:03
mveRichard MacCutchan28-Mar-16 7:03 
QuestionAlgorithm on secrete key generation Pin
Durga Prasad Chauhan26-Mar-16 0:32
MemberDurga Prasad Chauhan26-Mar-16 0:32 
AnswerRe: Algorithm on secrete key generation Pin
Richard MacCutchan26-Mar-16 2:32
mveRichard MacCutchan26-Mar-16 2:32 
AnswerRe: Algorithm on secrete key generation Pin
Patrice T27-Mar-16 11:31
mvePatrice T27-Mar-16 11:31 
Questionvector in turbo c Pin
Ravinder Singh25-Mar-16 21:50
MemberRavinder Singh25-Mar-16 21:50 
AnswerRe: vector in turbo c Pin
Richard MacCutchan25-Mar-16 23:46
mveRichard MacCutchan25-Mar-16 23:46 
AnswerRe: vector in turbo c Pin
Patrice T27-Mar-16 11:18
mvePatrice T27-Mar-16 11:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.