Staging
v0.5.1
https://github.com/python/cpython
Revision 714168248d8d20f124e7249c93c211d478067a36 authored by Mark Dickinson on 17 March 2009, 18:07:41 UTC, committed by Mark Dickinson on 17 March 2009, 18:07:41 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70430 | mark.dickinson | 2009-03-17 18:01:03 +0000 (Tue, 17 Mar 2009) | 3 lines

  Fix bug in Decimal __format__ method that swapped left and right
  alignment.
........
1 parent 0ac5e63
Raw File
Tip revision: 714168248d8d20f124e7249c93c211d478067a36 authored by Mark Dickinson on 17 March 2009, 18:07:41 UTC
Merged revisions 70430 via svnmerge from
Tip revision: 7141682
sleep.c
#include "oslib/osmodule.h"
#include <stdio.h>
#include "kernel.h"
#include <limits.h>
#include <errno.h>
#include "oslib/taskwindow.h"
#include "Python.h"


int riscos_sleep(double delay)
{
	os_t starttime, endtime, time; /* monotonic times (centiseconds) */
	int *pollword, ret;
	osbool claimed;

        /* calculate end time */
	starttime = os_read_monotonic_time();
	if (starttime + 100.0*delay >INT_MAX)
		endtime = INT_MAX;
	else
		endtime = (os_t)(starttime + 100.0*delay);

	/* allocate (in RMA) and set pollword for xupcall_sleep */
	pollword = osmodule_alloc(4);
	*pollword = 1;

	time = starttime;
	ret = 0;
	while ( time<endtime && time>=starttime ) {
		xupcall_sleep (pollword, &claimed);
		if (PyErr_CheckSignals()) {
			ret = 1;
			break;
		}
		time = os_read_monotonic_time();
	}

	/* deallocate pollword */
	osmodule_free(pollword);
	return ret;
}
back to top