For all purposes under this code, members of the National Guard who entered the active military service of the United States in time of war or under a call, order, or draft by the President or who hereafter enter such service under like conditions or who enter and serve on active duty in the military service of the United States in time of peace or war and who thereafter return to the military service of the state shall be entitled to credit for time served as if such service had been rendered to the state.