Hacker News new | past | comments | ask | show | jobs | submit login

Is there an equivalent tool for *nix OSes?



faketime '2008-12-24 01:15:43' /bin/date


I like differences between OS philosophies. It allows us to see how some things can be done way simpler and highlights strengths and weaknesses of different ideas.

Not being a windows guy for a long time, I was impressed that windows users were happy when chrome implemented the "print to pdf" feature, I said "CUPS let me print to ps or pdf a decade ago". Another moment like that was when I showed the 'time' command to a student as a crude benchmark for algorithms and also using LD_PRELOAD to easily show that his code had leaks, then complemented it with valgrind and leak sanitizer.

Leak sanitizer is multi-platform, valgrind can be replaced by drmemory and, of course, windows has many advantages that made it earn the desktop but, at the time, nothing like that was close on windows as a quick apt-get.

A trick I usually do these days is when someone argues about developing something new. I think about a somewhat similar package and "apt-get build-dep" and "apt-get source" it. In a matter of minutes I have dependencies for a package, its source code, compile and install it. People always get impressed at how easy it can be.


What is the difference in philosophy here?

RunAsDate also has an equivalent cmdline interface, if that is what you are referring to?


faketime is great. I use it in continuous integration tests for some software that needs to work correctly in temporal edge cases (near midnight, leap days, etc.)


Can it also slow down the clock?


Indeed, you can: faketime -f '+2y x0.1' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: