As far as I can tell, it is measured by steps. It doesn't appear to be measured by in-game time, real time, level-ups or if the berry gets consumed.
I also don't know how much steps it takes. I tried counting it once. After 66,000 steps it was still a Berry, so I know it is more than that, but I don't think much more. To compare, that is over twice as much as the slowest eggs.
The Berry won't get turned into Berry Juice if the Shuckle is in a PC either.
I've never had a Berry Juice being turned into a Rare Candy, even after carrying Shuckle with me during the entire game. So either that number is too high to normally achieve, or the Rare Candy is just a myth.