5

I am looking for a way to start an application with an alternate system time than that which is set. Basically one of the beta programs I use has a bug (it really is a bug) that no longer lets it work past January 29th. Setting my system time to a few day prior fixed the issue and the app works fine now. However some of my other applications are not working properly anymore.

As a general question (I could see my self using this for other things), is it possible to launch an application and make it think there is an alternate system time?

Specifically though, I am running Mac OS 10.7.2 and I'm trying to launch MouseShare with an alternate system time than that which is set.

Mat
  • 52,586
rudolph9
  • 1,425
  • I'm pretty sure you could use LD_PRELOAD to intercept the library calls, but I'm really no expert on that. There may be other questions around here that explain how. – Kevin Jan 30 '12 at 05:32

1 Answers1

7

Use libfaketime:

FTPL intercepts various system calls which programs use to retrieve the current date and time. It can then report faked dates and times (as specified by you, the user) to these programs. This means you can modify the system time a program sees without having to change the time system- wide.

See: http://www.code-wizards.com/projects/libfaketime/

gby
  • 366
  • Ok this is great! and exactly what I was looking for, however I cannot get the library to function in Mac OSX... I am using 10.7.2 and I do exactly as the readme specifies for mac osx but upon running a command such as LD_PRELOAD=/Users/rudolph9/Developer/libfaketime/src/libfaketime.dylib.1 FAKETIME="@2012-01-01 20:20:00" date Mon Jan 30 08:21:17 CST 2012 I do not get the desired date – rudolph9 Jan 30 '12 at 14:24
  • Sorry, I don't own a Mac... – gby Jan 31 '12 at 06:23
  • no worries I got it working, Thanks for the suggestion! – rudolph9 Jan 31 '12 at 11:33
  • Current URL of project: https://github.com/wolfcw/libfaketime – mpy Feb 21 '23 at 18:57