Raised This Month: $ Target: $400
 0% 

Calculate days


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 04-25-2011 , 19:52   Calculate days
Reply With Quote #1

I think the topic title says it all. I'm trying to find a way to calculate days before the the plugin prune the vault file.

Here is my code:
PHP Code:
public test(idlvlcid)
{
    if(!
cmd_access(idlvlcid3))
        return 
PLUGIN_HANDLED
    
    
new arg[32], Value[32], TimeStamp
    
    
new dMonthdDaydYeardHourdMinutedSecond
    
new iMonthiDayiYeariHouriMinuteiSecond
    
    read_argv
(1arg31)
    
read_argv(2Value31)
    
    new 
data nvault_lookup(x_VaultargValue31TimeStamp)
    
    if(
data)
    {
        new 
CreateDate TimeStamp
        
new iUnixTime = ( TimeStamp + (10 86400) )
        
        
UnixToTimeCreateDate dYear dMonth dDay dHour dMinute dSecond )
        
UnixToTimeiUnixTime iYear iMonth iDay iHour iMinute iSecond )
        
        
console_print(id"Created: = %02d/%02d/%02d %02d:%02d:%02d" dYear dMonth dDay dHour dMinute dSecond )
        
console_print(id"Prune: = %02d/%02d/%02d %02d:%02d:%02d" iYear iMonth iDay iHour iMinute iSecond )
        
        new 
HowToCalculateDays = ???
        
        
console_print(id"Day's remaining to prune x_Vault: %d"HowToCalculateDays)
    }
    else
    {
        
        
console_print(id"No existing data !")
    }
    return 
PLUGIN_HANDLED

killergirl is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-25-2011 , 20:04   Re: Calculate days
Reply With Quote #2

Code:
new iTotalSecondsLeft = iUnixTime - CreateDate; new iDaysLeft = iTotalSecondsLeft / 86400;
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-25-2011 , 20:07   Re: Calculate days
Reply With Quote #3

Code:
iDays_until_FutureDate = (iFutureDateTimestamp - iNowDateTimestamp) / 86400
Edit: Guess I should refresh before posting
__________________
fysiks is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 04-27-2011 , 07:08   Re: Calculate days
Reply With Quote #4

Oh, thank you it's working but not the how I want. The plugin calculates the day's when will prune the vault file, and not how many day's remaing to prune.

e.g

Created on: 11/05/2011
Prune on: 21/05/2011
Current day: 15/05/2011

Days remaing before pruning: 6
killergirl is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-27-2011 , 14:51   Re: Calculate days
Reply With Quote #5

Code:
new iTotalSecondsLeft = iUnixTime - get_systime(); new iDaysLeft = iTotalSecondsLeft / 86400;
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-27-2011 , 18:27   Re: Calculate days
Reply With Quote #6

Guess s/he didn't feel like reading my post . . .
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode