@freemo 2 whole seconds?? At that point just take a picture, it'll last longer :P
The general rule is "If the amount of time you're looking would damage your retinas from looking at the sun at noon during summer, it's too long of a glance". There is a difference between "noticing", "looking", "staring", and 2 solid seconds is straddling the line of the latter two, and the first is universally fine, but that's like 0.5-0.75 seconds.
As an aside, nearly all (more on this below) women know what they're signing up for when the go out dressed a certain way, so don't ask, don't stare, but a passing glance, even if she notices, is likely acceptable, though this depends on the woman and her understanding of male psychology as a function of her dressing habits.
I had to have this conversation with my (then girlfriend) wife about how she was drawing attention to herself with her very tight fitting crop-tops and short shorts. Her mom did some strange parenting to her daughters, so my wife didn't know until I spelled it out and then she was mortified at how men were looking at her. She just thought they were "being friendly" 🤦♂️