Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated logic in checkMainTransfer and checkSpenderTransfer #19

Open
adria0 opened this issue Apr 20, 2017 · 1 comment
Open

Duplicated logic in checkMainTransfer and checkSpenderTransfer #19

adria0 opened this issue Apr 20, 2017 · 1 comment

Comments

@adria0
Copy link

adria0 commented Apr 20, 2017

Consider move this base logic (not code) into a separate function, is used by checkMainTransfer and by checkSpenderTransfer

uint actualDay = now / 86400;       //Number of days since Jan 1, 1970 (UTC Timezone) fractional remainder discarded
uint actualTime = now % actualDay;  //Number of seconds since midnight (UTC Timezone)

if (actualTime < spender.openingTime) actualDay--; // adjusts day to start at `mainopeningTime`

uint timeSinceOpening = now - (actualDay * 86400 + spender.openingTime);

uint windowTimeLength = spender.closingTime >= spender.openingTime ?
                                spender.closingTime - spender.openingTime :
    
@jbaylina
Copy link
Contributor

I use actualDay to determine also when the Day Start, so it's not easy to isolate it without disoptimizing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants