Converting a specific date to epoch
I want to make a plugin wich execute a certain command at a specific time. There are some cvar like:
Code:
p_Year = register_cvar("sh_resetyear", "2014")I need to transform a date into epoch time so I could use get_systime() and obatin the difference(in seconds) between today and a specific date. After I get the result of this difference I can easily find out how many days, hours, minutes and seconds are until the execution of the command, so I can show it on a hud message. Now you know what my plugin should do. I think that this method is the best, if you know another wich is better please share it with me or help me to transform a specific date into epoch. |
Re: Converting a specific date to epoch
Well, as far as I know, you have to convert each value to seconds (because that's the value of get_systime). So simply increase the values by 60, 3600, 86400, etc. I tihnk you got my idea. Take a look here, too, https://forums.alliedmods.net/showthread.php?t=23912
|
Re: Converting a specific date to epoch
Right... I have to convert each value to seconds. Try to convert a date and you'll find out that is not as simple as you think since there are years with 365 days, 366 days etc...
|
Re: Converting a specific date to epoch
Rather than trying to figure out how to convert it, try explaining what it is that you are doing. There may be an easier way
|
Re: Converting a specific date to epoch
Also, there is a cronjob plugin for AMXX.
|
Re: Converting a specific date to epoch
I am trying to make a plugin wich execute a command at a specific date, hour and minute. This plugin should also show a cooldown in last 3 days.(e.g. 2 days, 8 hours, 1 minute, 32 seconds)
|
Re: Converting a specific date to epoch
I like the fact you completely ignored my post, but I'll be nice and post you a link anyway:
https://forums.alliedmods.net/showth...=69068?t=69068 |
Re: Converting a specific date to epoch
I ignored your post because it doesn't help me. I already knew about this plugin... isn't good for me because have many useless features for me. Also, I can't add a hud countdown message.
|
Re: Converting a specific date to epoch
Then good luck recreating something that already exists.
|
Re: Converting a specific date to epoch
Our friend Bugsy made a useful include time ago: https://forums.alliedmods.net/showthread.php?t=91915 take a look and use TimeToUnix.
|
| All times are GMT -4. The time now is 12:59. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.