Here is how New York law defines it:

A person is guilty of loitering when he:
    1. Loiters, remains or wanders about in a public place for the purpose
  of begging; or
    2.  Loiters  or  remains in a public place for the purpose of gambling
  with cards, dice or other gambling paraphernalia; or
    3. Loiters or remains in a public place for the purpose  of  engaging,
  or  soliciting  another  person  to engage, in oral sexual conduct, anal
  sexual conduct or other sexual behavior of a deviate nature; or
    4. Being masked or in any manner disguised  by  unusual  or  unnatural
  attire or facial alteration, loiters, remains or congregates in a public
  place with other persons so masked or disguised, or knowingly permits or
  aids  persons  so  masked  or disguised to congregate in a public place;
  except that such conduct is not unlawful when it  occurs  in  connection
  with   a   masquerade   party   or  like  entertainment  if,  when  such
  entertainment is held in a city which  has  promulgated  regulations  in
  connection  with  such  affairs,  permission  is first obtained from the
  police or other appropriate authorities; or
    5. Loiters or remains  in  or  about  school  grounds,  a  college  or
  university building or grounds or a children's overnight camp as defined
  in  section  one  thousand three hundred ninety-two of the public health
  law or a summer day camp  as  defined  in  section  one  thousand  three
  hundred  ninety-two  of the public health law, or loiters, remains in or
  enters a school bus as defined in section one hundred forty-two  of  the
  vehicle and traffic law, not having any reason or relationship involving
  custody  of  or  responsibility  for  a  pupil  or student, or any other
  specific, legitimate reason for being  there,  and  not  having  written
  permission  from  anyone  authorized  to  grant  the  same or loiters or
  remains in or about such children's overnight camp or summer day camp in
  violation of conspicuously posted rules or regulations  governing  entry
  and use thereof; or
    6.   Loiters   or  remains  in  any  transportation  facility,  unless
  specifically authorized to do so,  for  the  purpose  of  soliciting  or
  engaging in any business, trade or commercial transactions involving the
  sale  of  merchandise  or  services,  or for the purpose of entertaining
  persons by singing, dancing or playing any musical instrument; or
    7. Loiters or remains in any  transportation  facility,  or  is  found
  sleeping  therein,  and  is unable to give a satisfactory explanation of
  his presence.
    Loitering is a violation.

But the law doesn't spell out a particular length of time. It certainly would be many minutes, not seconds.