I have a method that calls localtime, which I wrote for unit test for. I take away the challenge localtimein my test to find out the expected answers. So far, so good. I run unit test on a machine in a different time zone, and, as predicted, the tests fail because they take several hours. I believe that I could dynamically determine the correct expected values, but this seems to contradict the idea of knowing the answer before asking the question.
Any thoughts on how to approach this? Override localtime? It seems extreme.
Thank!
source
share