Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
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 5:32
add comment

1 Answer 1

up vote 5 down vote accepted

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/

share|improve this answer
    
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 6:23
    
no worries I got it working, Thanks for the suggestion! –  rudolph9 Jan 31 '12 at 11:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.