Visible to the public Time-constrained data harvesting in WSNs: Theoretical foundation and algorithm design