Im struggling to check if there is at least a minute between two date times. I created a game in c# and have limited a part of my game to once a minute every time this command is executed it runs a void
The problem is that it does it even if it hasn't been a minute?
public void _CheckIfBeenAMinute
{
string TimeStamp;
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT game_timestamp FROM users WHERE id=" + Session.Id + "");
TimeStamp = dbClient.getString();
}
DateTime TimeStamp_Converted = Convert.ToDateTime(TimeStamp);
if (TimeStamp_Converted > DateTime.UtcNow.AddMinutes(-1))
{
//It has been a minuted...
//But the problem is, i it hasnt been it still does this?
this.SendMessage("You have reached your limit today");
return;
}
}
EDIT: I have decided to use timespan. But when I try to get the seconds of the timespan after it has reached 60 it resets?