|Dinosaurs were the dominant vertebrate animals of the terrestrial ecosystems for over 160 million years, from the late Triassic period (about 230 million years ago) to the end of the Cretaceous period (65 million years ago). They are divided into a number of subgroups, the largest two being based on the structure of the hip. Saurischians retained the lizard-like hips of their ancestors, and included theropods like Tyrannosaurus and sauropodomorphs like Diplodocus. Ornithischians were herbivores with bird-like hips, and included such groups as armored, horned, bone-headed, and duck-billed dinosaurs. These groups evolved a variety of adaptations and occupied diverse niches as the Earth and its environments changed during the Mesozoic Era, but (with the exception of birds;), perished in the Cretaceous Tertiary extinction event approximately 65 million years ago.