In code we define INDEFINITELY_LOOPING_DURATION as 10000 to show that a sound will loop forever (and to ensure that anything using it literally won’t stop for a long time at least). Even in a non-looping SoundCue the duration can be a best guess, if there are random nodes involved or changes in pitch etc.
If you want to get the original duration of the sound file then you will need access to the SoundWave that you are using in the SoundCue (or just use a SoundWave instead of a cue if it is a simple sound loop). There you’ll want to check the Duration property (which is inherited from SoundBase). There is also a GetDuration function but this works just like the SoundCue, it returns INDEFINITELY_LOOPING_DURATION if the SoundWave’s Looping property is set.
If you do need to access the SoundWave from within the SoundCue, then I would advise using USoundCue::RecursiveFindNode like this:
// get all the waves this cue uses
TArray<USoundNodeWavePlayer*> WavePlayers;
Cue->RecursiveFindNode<USoundNodeWavePlayer>(Cue->FirstNode, WavePlayers);