Minor league assignments have to be at least 20 MiLB days in order not to count as Major League service (i.e. if you send a guy down for ten days and bring him back up, those ten days count as BL service). Days includes days off, so it's not explicitly game dependent. My rule of thumb for the beginning of the season is to leave the guy in AAA for a real-life calendar week after your minor league seasons start (so if your minor league season began on the AM cycle on Monday, April 16, the prospect is safe to call up after the PM2 cycle on Sunday, April 22).
To answer other questions, post-season service does not count; and the only absolutely safe time to demote a player is in the preseason between the time budgets are set and when rosters are frozen for the rule 5 draft. At any other time he may or may not take a hit, and that chance is a function based on the player's patience.