On Feb 24, 2005, at 5:58 PM, Norman Palardy wrote:
Here I figured this would be easy to do but in Carbon I'm finding this
is really a pain in the arse.
I've got code in XCode/CW that does this fine for Mach-O using the
standard C libraries but Carbon has been driving me nuts.
CW's libraries don't implement mktime in the same way as the Mach-O
standard libraries so the same code doesn't work in CW and XCode
This code in XCode
struct tm time_str;
time_str.tm_year = (year - 1900);
time_str.tm_mon = ( mon - 1);
time_str.tm_mday = day;
time_str.tm_hour = hour;
time_str.tm_min = minute;
time_str.tm_sec = seconds;
time_str.tm_isdst = -1;
mktime(&time_str) ;
return tm_str.tm_gmtoff ;
works and gets me the right gmt offset even when DST is in effect
seemingly all the time (or at least as well as can be had based on the
vagaries of things like DST)
But trying to get the using Carbon calls ... well ... there's another
matter.
It's just not working for me and is always off by the gmt offset ....
which if I could get that properly I could correct for ... you see my
problem.
I really need to be able to display any given date as "2005-01-01
16:05:03 +TZOffset" but the correct +tzoffset varies of course.
Anyone got any code that can actually do this properly ?
I've got REALbasic code calling Core Foundation that does it properly.
--------------
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|