Transmorphers

In 2009, a race of aliens piloting giant robots have conquered Earth and forced humanity to live underground. They have done this by altering the environment, causing constant rainfall and darkness. Over 300 years later, after many generations of living underground, a small group of human rebels plan to finally take back their world from the mechanical invaders. They soon learn however that the aliens do not pilot the robots, but are the robots.
A patrol, led by Lt. Blackthorn (Thomas Downey), is sent out to capture one of the robots, a Z-bot, so its operating ability can be studied. The patrol is suddenly ambushed by several robots, with some being able to reconfigure themselves, revealing different weapon systems. These units, the 'transmorphers', ambush humans by appearing as mundane features of the terrain, even fooling detection systems. The robots use "brain scans" to read the minds of humans to know their battle plans.
After Blackthorn's patrol is destroyed by the machines, a female lead officer of the human resistance group, General Van Ryberg (Eliza Swenson), argues with fellow officers of the Military and Science Guilds about how to fight the war. Despite some protests, Van Ryberg decides to reinstate a disgraced soldier named Warren Mitchell (Matthew Wolf), who was court-martialed along with his right-hand man, Itchy (Griff Furst), and cryogenically frozen for insubordination. They had killed their unit officer five years earlier. Mitchell is glad to be reinstated, but learns that his former lover, Karina Nadir (Amy Weber), a fighter pilot, is now married to General Van Ryberg.
Mitchell assembles a small military patrol with Itchy as his second-in-command, and Flight Commander Xandria Lux (Shaley Scott), as his military adviser. The patrol is sent out to capture a Z-bot, intact, so its fuel cells can be studied. They hope to shut the machines down by contaminating the fuel cell and placing it in a large radio tower which supposedly controls the machines.
Mitchell and his group ambush and destroy a group of patrol machines, and succeed in capturing one. During the battle, Karina and another female soldier named Blair (Sarah Hall) become stuck behind enemy lines right near the radio tower. They are forced to hide in the ruins around the tower while waiting for help to arrive.
Bringing the Z-bot back to their underground city, Mitchell realizes that the fuel cell has an implanted tracking device that leads the machines to the humans underground city. Van Ryberg takes over as the field commander of the human army and leads them out in a last-ditch effort to defeat the robots, and to rescue her wife.
Mitchell then surprisingly learns from resident scientist Dr. Voloslov Alextzavich (Michael Tower), that he himself is an android constructed by Dr. Alextzavich, with human feelings and understandings. Mitchell realizes that he must get the Z-bot's fuel cell to the radio tower and implant it in the control computer in order to shut the robots down.
Supported by an aerial strike force led by Lux, Mitchell's team fly out and make it to the radio tower where they are able to rescue Karina and Blair. The group breaks into the building, but the anti-human counter-measures make all of them sick and they cannot make it to the main control room. The situation becomes more complicated when the tower reveals itself to be a giant robot.
Meanwhile, General Van Ryberg and her soldiers reach one of the terraforming stations and attempt to take it offline. They attempt to hold off a massive army of robots attacking the underground city. Lux then arrives with her fighter squadron to bomb the attacking robots.
Back at the radio station, Mitchell, using his android abilities, sacrifices himself and takes the tower out, buying enough time for the rest of his team to escape. Once the tower is destroyed the robots all over the world shut down. With the battle won, Karina and Van Ryberg are reunited and the surviving humans see the sun shine through the clouds for the first time in centuries.

Question: Over how many years were generations living underground?
Answer: 300