WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 3b0cd388 authored by Tobias Pape's avatar Tobias Pape Committed by Stefan Marr
Browse files

push time and random to universe

first, _start_time in the primitve module would be frozen on translate time
and not set when the binary starts.

second, python random is not rpython, we use rrandom
parent 2504504e
......@@ -5,7 +5,6 @@ from som.vmobjects.integer import integer_value_fits, Integer
from som.vmobjects.double import Double
import math
import random
def _push_long_result(frame, result, universe):
# Check with integer bounds and push:
......@@ -34,7 +33,8 @@ def _sqrt(ivkbl, frame, interpreter):
def _atRandom(ivkbl, frame, interpreter):
rcvr = frame.pop()
frame.push(interpreter.get_universe().new_integer(rcvr.get_embedded_integer() * random.random()))
rcvr.get_embedded_integer() * interpreter.universe().random.random())))
def _plus(ivkbl, frame, interpreter):
right_obj = frame.pop()
......@@ -5,8 +5,6 @@ from som.vm.universe import std_print, std_println
import time
_start_time = time.time() # a float of the time in seconds
def _load(ivkbl, frame, interpreter):
argument = frame.pop()
frame.pop() # not required
......@@ -37,13 +35,13 @@ def _print_newline(ivkbl, frame, interpreter):
def _time(ivkbl, frame, interpreter):
frame.pop() # ignore
_time = time.time() - _start_time
frame.push(interpreter.get_universe().new_integer(_time * 1000))
_time = time.time() - interpreter.universe().start_time
frame.push(interpreter.universe().new_integer(int(_time * 1000)))
def _ticks(ivkbl, frame, interpreter):
frame.pop() # ignore
_time = time.time() - _start_time
frame.push(interpreter.get_universe().new_integer(_time * 1000000))
_time = time.time() - interpreter.universe().start_time
frame.push(interpreter.universe().new_integer(int(_time * 1000000)))
def _fullGC(ivkbl, frame, interpreter):
# naught - GC is entirely left to Python
from rpython.rlib.rrandom import Random
from som.interpreter.interpreter import Interpreter
from som.interpreter.bytecodes import Bytecodes
from som.vm.symbol_table import SymbolTable
......@@ -18,6 +20,8 @@ from som.vm.shell import Shell
import som.compiler.sourcecode_compiler as sourcecode_compiler
import os
import time
from rlib.exit import Exit
from rlib.osext import path_split
......@@ -54,6 +58,9 @@ class Universe(object):
self._avoid_exit = avoid_exit
self._dump_bytecodes = False
self.classpath = None
self.start_time = time.time() # a float of the time in seconds
self.random = Random(abs(int(time.clock() * time.time())))
def exit(self, error_code):
if self._avoid_exit:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment