[Pythonmac-SIG] Problems with multithreaded I/O or import, an yone?

Schollnick, Benjamin Benjamin.Schollnick@usa.xerox.com
Wed, 29 Aug 2001 08:20:06 -0400


Because it's not very generic?

		if sys.platform == "mac":
				import calldll
				macadjustment = 126230400L
				OSUtils = calldll.getlibrary('InterfaceLib')
				setmacdatetime =
calldll.newcall(OSUtils.SetDateTime, 'None', 'InLong', 'InLong')
				
				tempval = timevalue - macadjustment 
				tempval = tempval - time.timezone
				tempval = int(tempval - 0x100000000L)
				tempval = int(tempval)
				templo = int(tempval & 0xffffffff)+86400
				temphi = int((tempval >> 32) & 0xfffffff)

				setmacdatetime(templo, temphi)

The timevalue is the value that we have received from the time server...
(milliseconds from 1970)
MacAdjustment is the amount of time (in milliseconds) from 1970 to the
macintosh epoch... (1/1/1974)

So I'd suggest two interfaces:

	1 -> Time from epoch (milliseconds)
	2 -> Time passed via time tuple

The first would be functionality equivalent....

The second, would be mostly a interface/def difference...
The difference is a mktime call to generate the millisecond based time
value...

If your interested, I'll try to clean up the code...

My major concern is that with Mac OS X, I do not believe that this code
would work under X.
(Anyone validate this? can CALLDLL be used under X?)  And if it's not
supported under X,
I think we need to decide on a mechanism to support both X & classic.

This code was donated:

		if sys.platform == "posix":
			t = timetuple
			cmd = "date %02d%02d%02d%02d%04d.%02d" % (t[1],
t[2], t[3], t[4], t[0], t[5])
			os.system (cmd)

I don't have a system to test this on, and I'm not even sure if the date
command works under 
Mac OS X..... (I suspect it does, but I don't know if the syntax is the
same... Anyone able to
check the man pages for X?  Does X even have man pages?)......


			- Benjamin




-----Original Message-----
From: Jack Jansen [mailto:jack@oratrix.nl]
Sent: Wednesday, August 29, 2001 8:03 AM
To: Schollnick, Benjamin
Subject: Re: [Pythonmac-SIG] Problems with multithreaded I/O or import,
an yone?


Ah, setting the clock. That's not goint to be high on my priority list. But:

if you have code that does it, why not contribute it?
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig
++++
www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm