Project Timepiece was a 23rd and 24th century Federation temporal research facility located on the planet Gateway. It was established after Captain James T. Kirk discovered an ancient temporal gateway on the planet.
In 2268 professor Daniels who was working at the facility discovered a much larger version of the gateway after a dam-burst exposed the area. Security around the site was quickly increased and major workers were given clearance level alpha.
Several months later, Dr. Ann MacGregor and Commander Spock who was working on the project at the time detected a magnitute-ten variation in the natural flow of time. It seemed the entire planet had been protected from changes in the timeline due to the unusual time ripples in the region. Captain Kirk and the USS Farragut was called to the project to help determine the cause of the changes in the timeline. Kirk, Spock and Leonard McCoy used the smaller gateway to travel to the year 2006 after following some unusual readings from that time. They discovered that when Commodore Matthew Decker detonated his shuttlecraft within the planet killer (TOS: "The Doomsday Machine") it sent him back to the year 1967. They recovered microtapes from his shuttle and returned to 2268. There they discovered that when the USS Constellation was detonated within the planet killer it caused the weapon to not be destroyed but sent back in time to 2254, where it encountered and destroyed the USS Enterprise, thus causing the alternate timeline and the "Doomsday War".
Dr. McGregor then showed them the larger version of the gateway which they used to send the entire ship back in time to correct the course of history. When they returned the timeline had been fully restored. The crew of the vessel and the workers of Project Timepiece were apparently the only ones aware of what had happened. (Star Trek: New Voyages: "In Harm's Way")