The number of days is computed from the moment of your first hack while the day counter is at 0. Starting from that moment, you need to ensure that every hack is no more than 24 hours after the previous one; otherwise, the counter will reset. (There is a little bit of a “grace period,” though its exact duration is unknown.) These hacks do not have to be at the same portal; any portal will do. The Sojourner medal is one of only two that rely on maintaining a streak (the other being the Guardian medal).
Note that sometimes due to connectivity issues, you may get a “Hack acquired no items” message. It’s best to hack the portal again, just in case your previous hack didn’t register with the server. Glyph hacking puts a confirmation message in your comm panel, so that’s a way that you can verify that the hack counted. To be safe, you may want to consider hacking early in the day and again later in the day, so that you can be certain that you’re never letting too much time go by.
The Sojourner medal was introduced on 6 March 2015.