How Can We Help?

Print

Time between two schedules to start something in the next 24 hours

 

This example show how tocalaculate the time in minutes between two schedules (clock) to start something in the next 24 hours

We use a simple “numerical entry” to enter the schedule. It’s easier with a decimal point to separate the hour from the minutes (simple numerical pad)

You can dowload the project and try: TestStartTime

The script is as follows:

#include "MacroInit.h"
void Macro_main(IN *p)
{
MarcoInit
//ToDo
CurrentMin = BCD2BIN(LocalWord[60001]);
CurrentHou = BCD2BIN(LocalWord[60002]);
StartHou = LocalWord[10]/100;
StartMin = LocalWord[10]-(StartHou*100);
int StartHou24=StartHou;
if ((CurrentHou > StartHou) || ((CurrentHou == StartHou)&&(CurrentMin > StartMin))){
StartHou24=StartHou+24;
}
MinCurrent2StartTime=(((StartHou24*60)+StartMin)-((CurrentHou*60)+CurrentMin));
}