Skip to content

Commit 36d3122

Browse files
committed
Fixed an issue where time values were being treated as long, which on Windows is apparently 32 bit
1 parent 2c990f4 commit 36d3122

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

org.lflang/src/lib/Python/pythontarget.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131

3232
#include "pythontarget.h"
3333
#include "core/util.h"
34+
#include "core/tag.h"
3435

3536
//////////// set Function(s) /////////////
3637
/**
@@ -193,37 +194,35 @@ static PyObject* py_schedule_copy(PyObject *self, PyObject *args) {
193194
* Return the elapsed physical time in nanoseconds.
194195
*/
195196
static PyObject* py_get_elapsed_logical_time(PyObject *self, PyObject *args) {
196-
return PyLong_FromLong(get_elapsed_logical_time());
197+
return PyLong_FromLongLong(get_elapsed_logical_time());
197198
}
198199

199200
/**
200201
* Return the elapsed physical time in nanoseconds.
201202
*/
202203
static PyObject* py_get_logical_time(PyObject *self, PyObject *args) {
203-
return PyLong_FromLong(get_logical_time());
204+
return PyLong_FromLongLong(get_logical_time());
204205
}
205206

206207
/**
207208
* Return the elapsed physical time in nanoseconds.
208209
*/
209210
static PyObject* py_get_physical_time(PyObject *self, PyObject *args) {
210-
return PyLong_FromLong(get_physical_time());
211+
return PyLong_FromLongLong(get_physical_time());
211212
}
212213

213214
/**
214215
* Return the elapsed physical time in nanoseconds.
215216
*/
216-
instant_t get_elapsed_physical_time();
217217
static PyObject* py_get_elapsed_physical_time(PyObject *self, PyObject *args) {
218-
return PyLong_FromLong(get_elapsed_physical_time());
218+
return PyLong_FromLongLong(get_elapsed_physical_time());
219219
}
220220

221221
/**
222222
* Return the start time in nanoseconds.
223223
*/
224-
instant_t get_start_time();
225224
static PyObject* py_get_start_time(PyObject *self, PyObject *args) {
226-
return PyLong_FromLong(get_start_time());
225+
return PyLong_FromLongLong(get_start_time());
227226
}
228227

229228
/**
@@ -1004,7 +1003,7 @@ get_python_function(string module, string class, int instance_id, string func) {
10041003

10051004
Py_SetPath(wcwd);
10061005

1007-
DEBUG_PRINT("Loading module %s in %s.", module, cwd);
1006+
DEBUG_PRINT("Loading module %s in %s.", module, cwd);
10081007

10091008
pModule = PyImport_Import(pFileName);
10101009

org.lflang/src/lib/Python/pythontarget.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4848
#include <structmember.h>
4949
#include "ctarget.h"
5050

51+
#include <limits.h>
52+
5153
#ifdef _MSC_VER
52-
#include <../include/limits.h>
53-
#include <windows.h>
5454
#ifndef PATH_MAX
5555
#define PATH_MAX MAX_PATH
5656
#endif
57-
#else
58-
#include <limits.h>
5957
#endif
6058

6159
// MODULE_NAME is expected to be defined in the main file of the generated code

0 commit comments

Comments
 (0)