Author: ArcRiley Date: 2009-01-10 11:03:01 -0500 (Sat, 10 Jan 2009) New Revision: 1461
Removed: trunk/pysoy/include/posix.pxd Modified: trunk/pysoy/include/g.pxd trunk/pysoy/include/windows.pxd trunk/pysoy/src/_internals/__init__.pym trunk/pysoy/src/_internals/_time.pym Log: replaced os-switched code in soy._internals._time with g.g_get_current_time() Modified: trunk/pysoy/include/g.pxd =================================================================== --- trunk/pysoy/include/g.pxd 2009-01-10 15:42:36 UTC (rev 1460) +++ trunk/pysoy/include/g.pxd 2009-01-10 16:03:01 UTC (rev 1461) @@ -21,6 +21,13 @@ cdef extern from "glib.h" nogil : ############################################################################# # + # enums and defines + # + ctypedef enum : + G_USEC_PER_SEC + + ############################################################################# + # # basic types # ctypedef void* gpointer @@ -58,6 +65,11 @@ guint domain gint code gchar* message + + ctypedef struct GTimeVal : + glong tv_sec + glong tv_usec + # ############################################################################# # @@ -103,7 +115,7 @@ cdef GHashTable* g_hash_table_ref ( GHashTable* ) cdef void g_hash_table_unref ( GHashTable* ) - cdef void g_thread_init ( GThreadFunctions* ) + cdef void g_thread_init ( GThreadFunctions* ) cdef GAsyncQueue* g_async_queue_new ( ) cdef void g_async_queue_unref ( GAsyncQueue* ) @@ -112,6 +124,7 @@ cdef gchar* g_strdup ( gchar* ) + void g_get_current_time ( GTimeVal* ) void g_usleep ( gulong ) # Deleted: trunk/pysoy/include/posix.pxd =================================================================== --- trunk/pysoy/include/posix.pxd 2009-01-10 15:42:36 UTC (rev 1460) +++ trunk/pysoy/include/posix.pxd 2009-01-10 16:03:01 UTC (rev 1461) @@ -1,27 +0,0 @@ -# Posix Declarations -# -# Copyright (C) 2006,2007,2008,2009 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 extern from "sys/time.h" nogil : - cdef struct timeval : - long int tv_sec - long int tv_usec - int gettimeofday (timeval *tv, void *tz ) - -cdef extern from "unistd.h" nogil : - void usleep(unsigned long usec) Modified: trunk/pysoy/include/windows.pxd =================================================================== --- trunk/pysoy/include/windows.pxd 2009-01-10 15:42:36 UTC (rev 1460) +++ trunk/pysoy/include/windows.pxd 2009-01-10 16:03:01 UTC (rev 1461) @@ -59,8 +59,6 @@ char* lpszMenuName char* lpszClassName - cdef void Sleep(DWORD) - cdef LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM) cdef BOOL SendNotifyMessage(HWND, UINT, WPARAM, LPARAM) cdef BOOL SetWindowText(HWND, char*) Modified: trunk/pysoy/src/_internals/__init__.pym =================================================================== --- trunk/pysoy/src/_internals/__init__.pym 2009-01-10 15:42:36 UTC (rev 1460) +++ trunk/pysoy/src/_internals/__init__.pym 2009-01-10 16:03:01 UTC (rev 1461) @@ -28,8 +28,3 @@ cimport py cimport stdio - -IF UNAME_SYSNAME == "Windows": - cimport windows -ELSE: - cimport posix Modified: trunk/pysoy/src/_internals/_time.pym =================================================================== --- trunk/pysoy/src/_internals/_time.pym 2009-01-10 15:42:36 UTC (rev 1460) +++ trunk/pysoy/src/_internals/_time.pym 2009-01-10 16:03:01 UTC (rev 1461) @@ -24,32 +24,7 @@ # 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 ) + cdef g.GTimeVal tv + + g.g_get_current_time(&tv) + return tv.tv_sec + ( <double> tv.tv_usec / <double> g.G_USEC_PER_SEC ) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn