PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: sinonjs/lolex (js)

Issue:
High-resolution timer gets tripped up by floating point arithmetic
* Lolex version : 2.7.4

**What did you expect to happen?**

Advancing the clock with fractional milliseconds should give me an integer nanosecond value when I call `process.hrtime(prev)`.

**What actually happens**

The nanosecond value is a float, not an integer.

**How to reproduce**

```js
const clock = lolex.install()
clock.tick(1022.7791)
clock.hrtime([0, 20000000]) // [ 1, 2779099.999999881 ]
```

The reproduction advanced the clock by a fraction of a nanosecond. I suppose it'd be fine to round the computed nanosecond value, but I'm not sure if it should be rounded up or down. Alternatively something like https://www.npmjs.com/package/decimal.js may help to avoid the floating point arithmetic. Perhaps `tick()` should round down to the closest nanosecond, but I'm not sure if that'll help or not.

Pull request:
fix: handle floating point in hrtime
#### Purpose (TL;DR) - mandatory
Fixes #207

/cc @novemberborn 

Patch:
diff --git a/src/lolex-src.js b/src/lolex-src.js
index 1693a68..7b9999c 100644
--- a/src/lolex-src.js
+++ b/src/lolex-src.js
@@ -101,7 +101,7 @@ function withGlobal(_global) {
      * % operator that also works for negative numbers
      */
     function fixedModulo(n, m) {
-        return ((n % m) + m) % m;
+        return Math.round(((n % m) + m) % m);
     }
 
     /**


Test patch:
diff --git a/test/lolex-test.js b/test/lolex-test.js
index 78d4423..a809783 100644
--- a/test/lolex-test.js
+++ b/test/lolex-test.js
@@ -2384,6 +2384,14 @@ describe("lolex", function () {
                 assert.same(result[0], 1);
                 assert.same(result[1], 0);
             });
+
+            it("should handle floating point", function () {
+                var clock = lolex.createClock();
+                clock.tick(1022.7791);
+                var result = clock.hrtime([0, 20000000]);
+
+                assert.equals(result, [1, 2779100]);
+            });
         });
     }
     if (nextTickPresent) {