File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88using System . Diagnostics ;
99using System . Globalization ;
1010using System . Linq ;
11+ using System . Numerics ;
1112using System . Runtime . CompilerServices ;
1213using System . Text ;
1314using System . Threading ;
1415
15- using Microsoft . Scripting ;
16- using Microsoft . Scripting . Runtime ;
17- using Microsoft . Scripting . Utils ;
18-
1916using IronPython . Runtime ;
2017using IronPython . Runtime . Operations ;
2118using IronPython . Runtime . Types ;
2219
20+ using Microsoft . Scripting ;
21+ using Microsoft . Scripting . Runtime ;
22+
2323[ assembly: PythonModule ( "time" , typeof ( IronPython . Modules . PythonTime ) ) ]
2424namespace IronPython . Modules {
2525 public static class PythonTime {
@@ -127,6 +127,13 @@ public static void sleep(double tm) {
127127 Thread . Sleep ( ( int ) ( tm * 1000 ) ) ;
128128 }
129129
130+ public static double monotonic ( )
131+ => ( double ) Stopwatch . GetTimestamp ( ) / Stopwatch . Frequency ;
132+
133+ // new in Python 3.7
134+ public static BigInteger monotonic_ns ( )
135+ => ( BigInteger ) Stopwatch . GetTimestamp ( ) * 1000000000 / Stopwatch . Frequency ;
136+
130137 public static double time ( ) {
131138 return TicksToTimestamp ( DateTime . Now . ToUniversalTime ( ) . Ticks ) ;
132139 }
You can’t perform that action at this time.
0 commit comments