Author: ArcRiley Date: 2008-04-22 05:01:33 -0400 (Tue, 22 Apr 2008) New Revision: 1249
Added: trunk/pysoy/src/_internals/_sleep.pym trunk/pysoy/src/_internals/_time.pym Removed: trunk/pysoy/src/_internals/_sleep-posix.pym trunk/pysoy/src/_internals/_sleep-win32.pym trunk/pysoy/src/_internals/_time-posix.pym trunk/pysoy/src/_internals/_time-win32.pym Modified: trunk/pysoy/src/_internals/soy._internals.pyx Log: No Ticket : * merged _sleep-posix.pym and _sleep-win32.pym to _sleep.pym * merged _time-posix.pym and _time-win32.pym to _time.pym * cleaned up soy._internals.pyx Deleted: trunk/pysoy/src/_internals/_sleep-posix.pym =================================================================== --- trunk/pysoy/src/_internals/_sleep-posix.pym 2008-04-22 08:24:17 UTC (rev 1248) +++ trunk/pysoy/src/_internals/_sleep-posix.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -1,21 +0,0 @@ -# PySoy _sleep Function (for Unix platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef void _sleep( unsigned int mseconds ) : - posix.usleep( mseconds * 1000 ) Deleted: trunk/pysoy/src/_internals/_sleep-win32.pym =================================================================== --- trunk/pysoy/src/_internals/_sleep-win32.pym 2008-04-22 08:24:17 UTC (rev 1248) +++ trunk/pysoy/src/_internals/_sleep-win32.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -1,22 +0,0 @@ -# PySoy _sleep Function (for Windows platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef void _sleep( unsigned int mseconds ) : - windows.Sleep(mseconds) - Added: trunk/pysoy/src/_internals/_sleep.pym =================================================================== --- trunk/pysoy/src/_internals/_sleep.pym (rev 0) +++ trunk/pysoy/src/_internals/_sleep.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -0,0 +1,37 @@ +# PySoy's _internals._sleep Function +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef void _sleep( unsigned int mseconds ) : + # + # Cross-platform sleep function + # + # This is pretty straight-forward. + # We're using Microsoft's time units (1/1000th of a second) since it's + # the lowest common denominator between the two (usleep is 1/1000000th) + # + IF UNAME_SYSNAME == "Windows" : + # + # 1 Microsoft Way (TM) -- ugh + # + windows.Sleep(mseconds) + ELSE : + # + # Everyone else (GNU, Darwin, etc) + # + posix.usleep( mseconds * 1000 ) Property changes on: trunk/pysoy/src/_internals/_sleep.pym ___________________________________________________________________ Name: svn:keywords + Id Deleted: trunk/pysoy/src/_internals/_time-posix.pym =================================================================== --- trunk/pysoy/src/_internals/_time-posix.pym 2008-04-22 08:24:17 UTC (rev 1248) +++ trunk/pysoy/src/_internals/_time-posix.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -1,23 +0,0 @@ -# PySoy _time Function (for Unix platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef double _time( ) : - cdef posix.timeval tv - posix.gettimeofday(&tv, NULL) - return tv.tv_sec + ( <double> tv.tv_usec / 1000000.0 ) Deleted: trunk/pysoy/src/_internals/_time-win32.pym =================================================================== --- trunk/pysoy/src/_internals/_time-win32.pym 2008-04-22 08:24:17 UTC (rev 1248) +++ trunk/pysoy/src/_internals/_time-win32.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -1,36 +0,0 @@ -# PySoy _time Function (for Windows platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef double _time(): - cdef windows.LONGLONG t - cdef windows.FILETIME ft - cdef windows.LARGE_INTEGER li - cdef double result - - windows.GetSystemTimeAsFileTime(&ft) - li.LowPart = ft.dwLowDateTime - li.HighPart = ft.dwHighDateTime - t = li.QuadPart / 10 # in 100-nanoseconds - ## I found this magic number on the Internet! - ## It reconciles Windows's epoch with Unix's. - #t -= 116444736000000000L - #t /= 10 # in microseconds - result = (<double>(t / 1000000)) + ((<double>(t % 1000000)) / 1000000) - return result - Added: trunk/pysoy/src/_internals/_time.pym =================================================================== --- trunk/pysoy/src/_internals/_time.pym (rev 0) +++ trunk/pysoy/src/_internals/_time.pym 2008-04-22 09:01:33 UTC (rev 1249) @@ -0,0 +1,55 @@ +# PySoy's internals._time Function +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef double _time( ) : + # + # Cross-platform time-of-day function + # + # Returns the current time as a double for number of seconds since epoch. + # For those who are not familiar, that's Midnight Jan 1st 1970 UTC. + # + IF UNAME_SYSNAME == "Windows": + # + # Microsoft has their own special way of handling time + # + cdef windows.LONGLONG t + cdef windows.FILETIME ft + cdef windows.LARGE_INTEGER li + cdef double result + # + windows.GetSystemTimeAsFileTime(&ft) + li.LowPart = ft.dwLowDateTime + li.HighPart = ft.dwHighDateTime + t = li.QuadPart / 10 # in 100-nanoseconds + # + ## I found this magic number on the Internet! + ## It reconciles Windows's epoch with Unix's. + #t -= 116444736000000000L + #t /= 10 # in microseconds + # + result = (<double>(t / 1000000)) + ((<double>(t % 1000000)) / 1000000) + return result + ELSE : + # + # Everyone else (GNU, Darwin, etc) uses the standard Posix method + # + cdef posix.timeval tv + # + posix.gettimeofday(&tv, NULL) + return tv.tv_sec + ( <double> tv.tv_usec / 1000000.0 ) Property changes on: trunk/pysoy/src/_internals/_time.pym ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/pysoy/src/_internals/soy._internals.pyx =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pyx 2008-04-22 08:24:17 UTC (rev 1248) +++ trunk/pysoy/src/_internals/soy._internals.pyx 2008-04-22 09:01:33 UTC (rev 1249) @@ -18,17 +18,12 @@ # $Id$ include "__init__.pym" -IF UNAME_SYSNAME == "Windows": - include "_sleep-win32.pym" - include "_time-win32.pym" -ELSE: - include "_sleep-posix.pym" - include "_time-posix.pym" - +include "_getQueue.pym" +include "_sleep.pym" +include "_time.pym" include "AsyncQueue.pym" include "Children.pym" include "Loadable.pym" include "Loopable.pym" include "LoopThread.pym" include "PointerSet.pym" -include "_getQueue.pym" _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn