An interesting algorithmic problem that I have recently stumbled across is how to 'guess' the year that a request was sent if the machine that it was received on has a different current time to the month and day contained within the request.
This problem came about as a result of a business requirement for a system that I am working on. My system sits between two parties:
My system therefore needs to somehow decide which year the request was sent. The inputs as far as I can see are the month/day in the request, and the current time my system. Note this could also occur in the case where the initiator is in a timezone that is behind my system's timezone.
A very naive approach would be to simply input the year of my own system in the middle. This would obviously cause bugs around midnight on new year's eve, when the initiator could send a request in 2015 and I receive it in 2016, for example, which would result in the receiver logging the request as being sent a year later than it did.
There are two more caveats to this problem: