# Thread: Problem with simple case statements

1. ## Problem with simple case statements

Hi, im trying to enter a couple of ints into a function and increment the value of the output depending on the value of the input.

The two input values are a set of int which have to be transformed into a value of absolute seconds by the program. It will then check the program and if the value falls between a couple of "epochs" will increments as required.

So far, i get a load of:

error C2051: case expression not constant
errors. can someone tell me what im doing wrong and a possible solution?

The relevent section of my code, is below:

thanks

Code:
```            double abs_GPS;

time_t current;

struct tm* loctime;

abs_GPS = ((604800 * RX_WEEK) + (GPS_SEC)); /* convert to absolute GPS time	*/

current = (abs_GPS + 315964800);           /* Add absolute GPS time to the UTC epoch  */

/*The below case statements determine the time which the GPS relates to and adds any leap seconds that are needed */

switch (current)
{
case current <= 46915200:  current = current + 1;				/* Add one leap second */
break;

case  ((current >= 46915201) && (current =< 78451200)):  current = current + 2;	/* Add two leap seconds */
break;

case  ((current >= 78451201) && (current =< 109987200)):  current = current + 3;	/* Add three leap seconds */
break;

case  ((current >= 109987201) && (current =< 173145600)):  current = current + 4;	/* Add four leap seconds */
break;

case  ((current >= 173145601) && (current =< 252115200)):  current = current + 5;	/* Add five leap seconds */
break;

case  ((current >= 252115201) && (current =< 315273600)):  current = current + 6;	/* Add six leap seconds */
break;

case  ((current >= 315273601) && (current =< 346809600)):  current = current + 7;	/* Add seven leap seconds */
break;

case  ((current >= 346809601) && (current =< 394070400)):  current = current + 8;	/* Add eight leap seconds */
break;

case  ((current >= 394070401) && (current =< 425606400)):  current = current + 9;	/* Add nine leap seconds */
break;

case  ((current >= 425606401) && (current =< 457228800)):  current = current + 10;	/* Add ten leap seconds */
break;

case  ((current >= 457228801) && (current =< 504662400)):  current = current + 11;	/* Add eleven leap seconds */
break;

case  ((current >= 504662401) && (current =< 551923200)):  current = current + 12;	/* Add twelve leap seconds */
break;

case  ((current >= 551923201) && (current =< 599356800)):  current = current + 13;	/* Add thirteen leap seconds */
break;

case  ((current >= 599356801) && (current =< 820195200)):  current = current + 14;	/* Add fourteen leap seconds */
break;

case  current >= 820195201:  current = current + 15;	/* Add fifteen leap seconds */
break;

}```

2. >>error C2051: case expression not constant