Strangely, my Alarm Manger is calling the pending intent immediately, even though I have put a condition if the current time is greater than alarm time run one day later.

I have alarm Manger to trigger everyday at 10PM.

```
  Intent startServiceIntent = new Intent(this, numbers.class);
  this.startService(startServiceIntent);

            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(res.getString(R.string.hoursvalue))); //10
            cal.set(Calendar.MINUTE, 0);
            cal.set(Calendar.SECOND, 0);
            cal.set(Calendar.AM_PM, Calendar.PM);
            cal.set(Calendar.MILLISECOND, 0);

            long alarmtime = cal.getTimeInMillis();

            Log.e("ALarm","Time"+alarmtime);

            if (currenttime > alarmtime)
            {
                alarmtime = alarmtime + AlarmManager.INTERVAL_DAY;
                Log.e("Current Time","Greater"+alarmtime);
            }

            if (currentapiVersion >= 19)
            {
                AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                Intent intent2 = new Intent(this, ServiceForLoadingOnlineNumbers.class);
                PendingIntent pi = PendingIntent.getService(this, 741258963, intent2, 0);
                am.setInexactRepeating(AlarmManager.RTC_WAKEUP, alarmtime, AlarmManager.INTERVAL_DAY, pi);
            }
            else if (currentapiVersion >= 16 && currentapiVersion < 19)
            {
                AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                Intent intent3 = new Intent(this, ServiceForLoadingOnlineNumbers.class);
                PendingIntent pi = PendingIntent.getService(this, 741258963, intent3, 0);
                am.setRepeating(AlarmManager.RTC_WAKEUP, alarmtime, AlarmManager.INTERVAL_DAY, pi);
            }

```

The Log shows the next day in milliseconds correctly but triggers immediately. What could be the issue here?