[comp.sys.mac.programmer] How do you read the Mac's clock in THINK C?

wbridgm@hubcap.clemson.edu (william t bridgman) (12/05/90)

I have been using THINK C on my Macintosh for about 6 months now, writing code
that can be ported between the Mac & DECStations.  Up to now I haven't needed
to directly access the Mac Toolbox.

How do you read the current clock time in THINK C on the Mac?  The method I've
been trying NEVER reflects the actual clock time (by calling ctime(NULL)) but
some value that is apparently due to whatever random settings exist in the
memory location.

And to help prevent this problem from arising again, can anyone recommend a 
good book on programming in C specifically on the Mac (and possibly even
THINK C in particular?

Thanks... Tom


-----------------------------------------------------------------------
|  William T. "Tom" Bridgman         | wbridgm@hubcap.clemson.edu     |
|  Department of Physics & Astronomy |                                |
|  Clemson University                |"Black Holes under Construction.|
|  Clemson, SC   29634               |       WATCH YOUR STEP!"        |
-----------------------------------------------------------------------

Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (12/06/90)

> How do you read the current clock time in THINK C on the Mac?  The method
I've
> been trying NEVER reflects the actual clock time (by calling ctime(NULL))
but
> some value that is apparently due to whatever random settings exist in the
> memory location.
use GetTime(&d); where d is a DateTimeRec defined in OSUtil.h

> And to help prevent this problem from arising again, can anyone recommend
a
> good book on programming in C specifically on the Mac (and possibly even
> THINK C in particular?

There's a Macintosh Programming Primer -- Inside the Toolbox with THINK C
which I hear is very good.

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org

Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (12/08/90)

> How do you read the current clock time in THINK C on the Mac?  The method
I've
> been trying NEVER reflects the actual clock time (by calling ctime(NULL))
but
> some value that is apparently due to whatever random settings exist in the
> memory location.
GetTime(&d); where d is a DateTimeRec:
DateTimeRec
> 
> And to help prevent this problem from arising again, can anyone recommend
a
> 
> good book on programming in C specifically on the Mac (and possibly even
> THINK C in particular?
> 
> Thanks... Tom
> 
> 
> -----------------------------------------------------------------------
> I  William T. "Tom" Bridgman         I wbridgm@hubcap.clemson.edu     I
> I  Department of Physics & Astronomy I                                I
> I  Clemson University                I"Black Holes under Construction.I
> I  Clemson, SC   29634               I       WATCH YOUR STEP!"        I
> -----------------------------------------------------------------------
> 
> --- QM v1.23/b
>  * Origin: St Joseph's Medical Center Phoenix (602) 235-9653 (1:114/15.0)
> 


 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org