What does Auto Brightness actually do?

I have my phone set to auto brightness, what does it actually do? Does it adjust brightness due to time of day or does it sense how bright your surroundings are and adjust? Is it better for battery life? :greendroid: