anchor.diff:  	NextDay = calendar:date_to_gregorian_days(Date) + 1,
   	EndDate = calendar:gregorian_days_to_date(NextDay),
   	EndTime = {0, Minute, Second},
  -	calendar:datetime_to_gregorian_seconds({EndDate, EndTime}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({EndDate, EndTime}) - 1;
   end_period1({Date, {Hour, Minute, Second}}, hourly) ->
   	EndTime = {Hour + 1, Minute, Second},
  -	calendar:datetime_to_gregorian_seconds({Date, EndTime}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({Date, EndTime}) - 1;
   end_period1({Date, Time}, daily) ->
   	NextDay = calendar:date_to_gregorian_days(Date) + 1,
   	EndDate = calendar:gregorian_days_to_date(NextDay),
  -	calendar:datetime_to_gregorian_seconds({EndDate, Time}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
   end_period1({Date, Time}, weekly) ->
   	NextDay = calendar:date_to_gregorian_days(Date) + 7,
   	EndDate = calendar:gregorian_days_to_date(NextDay),
  -	calendar:datetime_to_gregorian_seconds({EndDate, Time}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
   end_period1({{Year, 1, 31}, Time}, monthly) ->
   	NextDay = calendar:last_day_of_the_month(Year, 2),
   	EndDate = {Year, 2, NextDay},
  -	calendar:datetime_to_gregorian_seconds({EndDate, Time}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
   end_period1({{Year, 2, Day}, Time}, monthly) when Day < 28 ->
   	EndDate = {Year, 3, Day},
  -	calendar:datetime_to_gregorian_seconds({EndDate, Time}) * 1000 - 1;
  +	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
   end_period1({{Year, 2, Day}, Time}, monthly) ->
   	EndDate = case calendar:last_day_of_the_month(Year, 2) of
   		Day ->
  
positive.code: 			last_modified = {Now, erlang:unique_integer([positive])}},
  	Subscriber#subscriber{buckets = NewBuckets, product = P}.
  
  
negative.code: 		_ ->
  			{Year, 3, Day}
  	end,
  	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
  end_period1({{Year, 3, 31}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 4, 30}, Time}) - 1;
  end_period1({{Year, 4, 30}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 5, 31}, Time}) - 1;
  end_period1({{Year, 5, 31}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 6, 30}, Time}) - 1;
  end_period1({{Year, 6, 31}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 7, 31}, Time}) - 1;
  end_period1({{Year, 8, 31}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 9, 30}, Time}) - 1;
  end_period1({{Year, 9, 30}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 10, 31}, Time}) - 1;
  end_period1({{Year, 10, 30}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 11, 30}, Time}) - 1;
  end_period1({{Year, 11, 30}, Time}, monthly) ->
  	gregorian_datetime_to_system_time({{Year, 12, 31}, Time}) - 1;
  end_period1({{Year, 12, Day}, Time}, monthly) ->
  	EndDate = {Year + 1, 1, Day},
  	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
  end_period1({{Year, Month, Day}, Time}, monthly) ->
  	EndDate = {Year, Month + 1, Day},
  	gregorian_datetime_to_system_time({EndDate, Time}) - 1;
  end_period1({{Year, Month, Day}, Time}, yearly) ->
  	EndDate = {Year + 1, Month, Day},
  	gregorian_datetime_to_system_time({EndDate, Time}) - 1.
  
  -spec subscription(Subscriber, Product, Characteristics) ->
  		Subscriber
  