How to stop previous interval and start new interval timer in C# - asp.net

How to stop previous interval(elapsedEvent) and start new interval(elapsedEvent) timer in C#.
Ex: I had interval with one hour with interval(elapsedEvent) , later user changed to two hours with interval(elapsedEvent).
While I tried to change one hour to two hour interval (elapsedEvent), it is coming for both one and two hours as well.
Need to change the interval (elapsedEvent) of timer what I given.

Related

(flutter) conver dart Time (not date) to Duration for Alarm

i want to set a daily alarm
but i can't convert the Hours and Minutes to Duration to make the Alarm work on time
so is there any Easy way to implement it
i was thinking in converting the time to DateTime and put the year month day etc etc
and then compare between them by Datetime.diffrence() method
like this
Duration duration = DateTime.now().difference(DateTime(DateTime.now().year,DateTime.now().month,DateTime.now().day,hour,minute));
but i think there is an easier way
so if someone can guide me :)
thank u
One option is to try and convert the hours and minutes to a duration something like below:
Duration time = new Duration(hours:2, minutes:3, seconds:2);

How to setup a day of week for reset Heroic instances?

The problem with changing the day of the week to reload heroic instances.
It's always Friday at 04:00.
I am trying to put in the config in the line:
Instance.ResetTimeRelativeTimestamp =
one of the other dates:
1552867201 = 18.03.2019 00:01 Monday
1552953600 = 19.03.2019 00:00 Tuesday
1553040001 = 20.03.2019 00:01 Wednesday
1552521601 = 14.03.2019 00:00 Thursday
1552608001 = 15.03.2019 00:01 Friday
1552694401 = 16.03.2019 00:01 Saturday
1552780801 = 17.03.2019 00:01 Sunday
Then I've cleared 3 tables in characters DB:
instance_reset
character_instance
instance
When I start the server - I see the same result - restart on Friday at 4:00.
Question: How to change the day of week? It must be Wednesday.
I actually just finished figuring this out myself. After much digging through the AzerothCore source, and it looks like the day of the week that instances are reset is chosen the very first time the server is started. As far as I can tell, ResetTimeRelativeTimestamp is not used to determine reset times. To be more specific:
The server starts up and starts to load instance reset times from the characters.instance_reset table
If an instance is missing an entry in the instance_reset table, an entry is added using the following formula:
Reset time = today(in UTC, rounded to nearest day) + RaidDuration(from mapdifficulty_dbc, named resetTime in code) + Instance.ResetTimeHour(from worldserver.conf)
Let's run through an example
You're in the US Central time zone, which is currently UTC-5. It's 2020_10_18 14:56:23, Convert that to UTC and you get: 2020_10_18 19:56:23. Round to the nearest day and you get UTC 2020_10_18 00:00:00
Let's say it's setting the reset time for ICC 10 man. If you look in mapdifficulty_dbc, RaidDuration is 604800 seconds, which is 7 days.
Let's say you have Instance.ResetTimeHour set to the default value, 4. This becomes 4 hours.
Plug this all in and you get resettime = 'UTC 2020_10_18 00:00:00' + 7 days + 4 hours = UTC 2020_10_25 04:00:00, a Sunday. Convert back to US Central time and you get: 2020_10_24 23:00:00 CST, a Saturday. Instances will reset on Saturday
The next time the instance is reset, its next reset time is reset using previous reset time + RaidDuration.
This means that if you want to choose the day of the week, you need to do one of the following:
Modify the instance reset times in the instance_reset table to be on the day of the week that you want. This approach is risky as it involves manipulating the reset timestamps in the DB directly
Empty the instance table, then start the server on the day you want instances to reset. Yes, this still involves DB manipulation, but at least the contents of the table are generated by Azeroth Core instead of yourself.
Here's what I did to solve the issue
The reason I've buried this so deeply in the answer is that you have to understand what you're doing before you start wiping out tables in your database. PROCEED WITH CAUTION.
Shut down the worldserver
Empty the characters.instance_reset table via SQL
Set your system time to some time before the current time that when converted to UTC falls on the day of the week you'd like instances to reset
Start the worldserver. Wait for it to load. Login and confirm that instance lockouts are expiring at the correct time.
Shut down the worldserver
Set your system time back to the correct time and start the server back up again

fullcalendar wrong timespamp for midnight

I am using fullcalendar.io and I realized that if I create a new event in the month view, dragging across one or more days, it returns a timestamp for the end date which is later rendered as 12 am of the day after while it should be logic that a function date("what-ever-format", timestamp) returns 12 pm of the current day, or, in any case, not the following day.
Any idea how to fix this???

Fullcalendar - Display an event with no end date

How do I go about displaying a long-running event with no end date? The data provided to me only shows when the event started but no end date because it's set to "Forever". It appears that when I only provide the start option, it only sets the event to show up on that day and not the following days.
I have a possible workaround for this, where if there is no end date from the event source, I always set the end date to 24 months from today, but that means if someone navigate the calendar past 24 months, the event would appear to have ended then. Would be nice to have something that will just keep going forever.

Fullcalendar day 24+7hours

im looking for way how to change start/end day of day.
For example: day start at 7am and end at 7am next day. In short i need to force calendar thinking day start and end +7hours
Any idea?
Look at nextDayThreshold
"When an event's end time spans into another day, the minimum time it must be in order for it to render as if it were on that day."
$('#calendar').fullCalendar({
nextDayThreshold: '07:00:00', // 7am
...
});

Resources