This is actually not possible. According to the C MEX S-Function documentation, "mdlInitializeSampleTimes" is only computed once, before the simulation loop. You can only access port signal values during the simulation loop, therefore the function "ssGetInputPortRealSignals" cannot be used in "mdlInitializeSampleTimes".
Check out the Simulink Engine Interaction with C S-Functions documentation for more information regarding the process.
Another option you have is to access the sample time of an Input port or inherit the sample time from as shown below:
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime( S, 0, INHERITED_SAMPLE_TIME );
ssSetOffsetTime( S, 0, 0 );
ssSetModelReferenceSampleTimeDefaultInheritance(S);
}