tass23

Member
So I'm looking at the changes to scripts from my test server compared to ServUO's latest repo and I have a question. I noticed that DateTime.Now has been altered in a couple of different ways and I'm curious as to why there are so many different ways now...

Old: DateTime.Now/DateTime.Now + TimeSpawn.FromSeconds(10)
New: DateTime.UtcNow, Core.TickCount, DateTime.Now + TimeSpan.FromSeconds(1000), Core.TickCount + TimeSpan.FromSeconds(1000)

When it comes to doing a merge, it's very confusing, as you can't simply change all DateTime.Now to DateTime.UtcNow for example.
 
Last edited:
The purpose of the change is have all times on the server consistent and to not have to adjust for daylight savings, etc. All times are now using UTC.

There are a few circumstances were we still want to use DateTime.Now. For example, in a gump, we might want to display the actual time to players and not the UTC time.

Core.Tickcount is used as a much more precise measure of short passages of time. Bascially, its the number of cpu "ticks" since server up. Think of the OnTick method you see in most timers. We can often use Core.Tickcount instead of setting a timer for some scripts.

For the most part, during a merge, you should be able to change all DateTime.Now to DateTime.UtcNow unless you want the actual time to display to someone.

The confusion comes in when the Core wants to use a TickCount instead of a DateTime due to a core change from RunUO to ServUO.
 
Ah, mmkay, thanks :)
I have run into a few instances where DateTime.Now remains DateTime.now as well. I've noticed too that you can't do certain operations when using one or the other (>=, <=, etc), you have to "switch" to one of the others.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back