From 4f360e63744fdb54045b9631c505590c3fdfc2a6 Mon Sep 17 00:00:00 2001
From: elsid <elsid.mail@gmail.com>
Date: Tue, 1 Nov 2022 22:12:25 +0100
Subject: [PATCH] Support negative days in TimeStamp

As vanilla engine does.
---
 apps/openmw/mwworld/timestamp.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/openmw/mwworld/timestamp.cpp b/apps/openmw/mwworld/timestamp.cpp
index ffb1cacb86..82a247a214 100644
--- a/apps/openmw/mwworld/timestamp.cpp
+++ b/apps/openmw/mwworld/timestamp.cpp
@@ -2,6 +2,7 @@
 
 #include <cmath>
 #include <stdexcept>
+#include <string>
 
 #include <components/esm/defs.hpp>
 
@@ -10,8 +11,8 @@ namespace MWWorld
     TimeStamp::TimeStamp (float hour, int day)
     : mHour (hour), mDay (day)
     {
-        if (hour<0 || hour>=24 || day<0)
-            throw std::runtime_error ("invalid time stamp");
+        if (hour < 0 || hour >= 24)
+            throw std::runtime_error("invalid time stamp hour: " + std::to_string(hour));
     }
 
     float TimeStamp::getHour() const