Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: InitDialog in splitter Pin
David Crow29-Mar-16 9:11
David Crow29-Mar-16 9:11 
Questionarduino sensor Pin
Member 1240312128-Mar-16 7:35
Member 1240312128-Mar-16 7:35 
AnswerRe: arduino sensor Pin
David Crow28-Mar-16 9:40
David Crow28-Mar-16 9:40 
AnswerRe: arduino sensor Pin
Richard MacCutchan28-Mar-16 21:44
mveRichard MacCutchan28-Mar-16 21:44 
GeneralRe: arduino sensor Pin
Sascha Lefèvre28-Mar-16 23:31
professionalSascha Lefèvre28-Mar-16 23:31 
GeneralRe: arduino sensor Pin
Member 1240312130-Mar-16 23:19
Member 1240312130-Mar-16 23:19 
GeneralRe: arduino sensor Pin
leon de boer3-Apr-16 6:43
leon de boer3-Apr-16 6:43 
QuestionCOleDateTime Pin
Still learning how to code27-Mar-16 9:48
Still learning how to code27-Mar-16 9: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();

Doug

AnswerRe: COleDateTime Pin
Serkan Onat27-Mar-16 12:44
professionalSerkan Onat27-Mar-16 12:44 
GeneralRe: COleDateTime Pin
Still learning how to code27-Mar-16 22:11
Still learning how to code27-Mar-16 22:11 
GeneralRe: COleDateTime Pin
Jochen Arndt28-Mar-16 1:50
professionalJochen Arndt28-Mar-16 1:50 
GeneralRe: COleDateTime Pin
Still learning how to code28-Mar-16 22:58
Still learning how to code28-Mar-16 22:58 
GeneralRe: COleDateTime Pin
Jochen Arndt28-Mar-16 23:08
professionalJochen Arndt28-Mar-16 23:08 
QuestionOld code Pin
RomTibi27-Mar-16 9:18
RomTibi27-Mar-16 9:18 
AnswerRe: Old code Pin
Patrice T27-Mar-16 10:46
mvePatrice T27-Mar-16 10:46 
AnswerRe: Old code Pin
Sascha Lefèvre27-Mar-16 12:38
professionalSascha Lefèvre27-Mar-16 12:38 
AnswerRe: Old code Pin
David Crow28-Mar-16 3:55
David Crow28-Mar-16 3:55 
SuggestionRe: Old code Pin
Richard MacCutchan28-Mar-16 6:08
mveRichard MacCutchan28-Mar-16 6:08 
AnswerRe: Old code Pin
Richard MacCutchan28-Mar-16 6:03
mveRichard MacCutchan28-Mar-16 6:03 
QuestionAlgorithm on secrete key generation Pin
Durga Prasad Chauhan25-Mar-16 23:32
Durga Prasad Chauhan25-Mar-16 23:32 
AnswerRe: Algorithm on secrete key generation Pin
Richard MacCutchan26-Mar-16 1:32
mveRichard MacCutchan26-Mar-16 1:32 
AnswerRe: Algorithm on secrete key generation Pin
Patrice T27-Mar-16 10:31
mvePatrice T27-Mar-16 10:31 
Questionvector in turbo c Pin
Ravinder Singh25-Mar-16 20:50
Ravinder Singh25-Mar-16 20:50 
AnswerRe: vector in turbo c Pin
Richard MacCutchan25-Mar-16 22:46
mveRichard MacCutchan25-Mar-16 22:46 
AnswerRe: vector in turbo c Pin
Patrice T27-Mar-16 10:18
mvePatrice T27-Mar-16 10: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.