Pass a SELECT result as an argument to postgreSQL function

Just enclose in round brackets:

get_timeinstate(
  (
    SELECT userid FROM "UserState" WHERE ctime>'2014-07-14'::timestamp
  )
);

Pass the returned user_id set as array. Create the function to accept an integer array

create function get_timeinstate (
    user_id_set integer[],
    another_param...

Then call it passing the array generated by array_agg

get_timeinstate(
    (
        select array_agg(userid)
        from "UserState"
        where ctime>'2014-07-14'::timestamp
    ),
    another_param
);

Inside the function:

where "UserState".userid = any (user_id_set)

BTW if you are using plpgsql you can place the query inside the function and pass just the date:

create function get_timeinstate (
    p_ctime timestamp,
    another_param...
$func$
declare
    user_id_set integer[] := (
        select array_agg(userid)
        from "UserState"
        where ctime > p_ctime
    );
begin
    return query
    select 
    ...myanotherquery...
    where "UserState".userid = any (user_id_set)
end;
$func$