<p>Is it good practice to have a unit test that specifies how long a certain function takes to return a value. I'm unit testing a curl function and want to specify that it needs to time out after 5 seconds. Is this in line with the way unit tests work?</p>

I don't think, that this is a test of the contract of the method. That's why I would say no, it's not an unit-test. But it sound like some sort of system-test.
Another point that disqualifies your example as unit-test is the fact, that it needs long time (5 seconds) to execute. Typically you should be able to execute the complete suite of unit-tests every time you do a change. You cannot wait long time.
That's why I think your test should be in another set of tests, than the unit-tests. It should be executed in your daily builds/continuous integration but not before every checkin from every programmer.