The people at the awooga blog needed a power outlet that would run a battery charger for a fixed period of time, and modified their own using Arduino-based hardware to solve the problem. At this point remember mains current can be lethal, and any mains current electrical work must be completed by a licensed electrician. However the design process for the outlet is interesting and the creators have described a successful project that looks good:
When working on your own projects that require accurate timing - consider using our super-accurate real-time clock module. Based on the DS3232, it has a temperature-controlled crystal oscillator for accurate time keeping, battery backup and 236 bytes of non-volatile memory for user data. For more information, see our modules page.