I normally don't count my encounters, so I'm not sure for certain what my longest hunt has been. The longest one that I've ever counted was Elgyem, who took me 4196 encounters, although she was my 6196th Pokemon seen in Black.
In terms of time, it's been over 4 years since I began my Treecko/Mudkip hunt, and I just got Treecko this February. *still hasn't gotten Mudkip*