So in the normal run of the game, it seems that the merchants always change their inventory when you come back to town. But if you leave town and come right back, they do not necessarily change.
To try and find out, I loaded up my Engineer, checked the Armorer and the Gem seller, walked out of town, and then waited 30 seconds before re-entering. I came in, checked their inventories, and left, which took about 20 seconds each time. That's a 50 second cycle, but I waited a full minute on my first town exit. The stated times include load screens (about 2 seconds in either direction; I started lap timers the moment load screens appeared).
It came to be that the gem seller changed just after 7 minutes and the armorer changed just before 8 minutes. In terms of time spent "outside" the town, gems reset at 4m45s minutes and armor reset at 5m45s.
I did nothing else beyond what was stated above. Just moved my character to change screens and clicked on the two merchants I was checking. This leads me to believe that time is the only factor in deciding when merchants reset, but can anyone continue this testing and determine an exact requirement?
Here is my data in an Excel spreadsheet. If anyone needs me to save it in an older Excel format, just let me know.