aljawaid / CostControl

Use the new Cost Control section to enable currencies and budgeting in Kanboard. Get live currency rates automatically for over 120 currencies allowing users to compare with manually saved rates. This plugin replaces and extends the features from the original Budget plugin enabling projects to have an associated cost element.
MIT License
4 stars 1 forks source link

Figure out how to refresh the data only once every 24hrs to avoid rate limiting #3

Closed aljawaid closed 1 year ago

aljawaid commented 1 year ago

maybe this will help... not sure

$timefromdatabase = 1489834968;

$dif = time() - $timefromdatabase;

if($dif > 86400)
{
echo 'more than 24 hours';
}else{
 echo 'less than 24 hours';
}

https://stackoverflow.com/questions/42875681/php-check-if-a-whole-24-hours-have-passed-with-time

aljawaid commented 1 year ago

image

I think we need to use the unix date to work out the 24hrs

creecros commented 1 year ago

Yes, that would be the best route.

aljawaid commented 1 year ago

but i still need to load the page to get the updated time right? i have the date coming from the json, but the php is loaded on page load.... so do i need to save the page load date/time in unix in a metasetting?