Calling getStartPeriod(long time) would never return the correct start period because offsets are calculated in the wrong direction (i.e. negative offsets go forward in time instead of back in time).
The easiest way to reproduce is to create a unit test when counter period is set to 1 day:
Calendar calendar = new GregorianCalendar(2011, Calendar.JANUARY, 15);
int offset = SocialCounterPeriodUtil.getStartPeriod(calendar.getTimeInMillis());